← All topics
Quiz: DP on Grids and Strings: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. In unique paths (moves only right or down), why is dp[i][j] = dp[i − 1][j] + dp[i][j − 1]?
- Q2. What does this print? (code)
- Q3. In LCS, what happens when a[i − 1] equals b[j − 1]?
- Q4. What does this print? (code)
- Q5. What is the difference between a subsequence and a substring?
- Q6. In edit distance, what are dp[i][0] and dp[0][j]?
- Q7. In the edit distance recurrence, dp[i − 1][j − 1] + 1 stands for which operation?
- Q8. What does this print? (code)
- Q9. Why is [[0] m] n a bug for a DP table in Python?
- Q10. You reduce the LCS table to two rows to save memory. What do you lose?