← Quiz: DP on Grids and Strings: all 10 questions
Quiz: DP on Grids and Strings · Question 5 of 10
What is the difference between a subsequence and a substring?
What is the difference between a subsequence and a substring?
- A.A subsequence keeps order but may skip letters; a substring must be continuous
- B.There is no difference
- C.A substring may skip letters; a subsequence cannot
- D.A subsequence must be a palindrome
Answer & explanation
Correct answer: A subsequence keeps order but may skip letters; a substring must be continuous
That is why longest common substring resets to 0 on a mismatch, while LCS takes max(up, left).
Can you get the rest right without peeking?
Take the timed Quiz: DP on Grids and Strings quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →