← Quiz: DP on Grids and Strings: all 10 questions
Quiz: DP on Grids and Strings · Question 6 of 10
In edit distance, what are dp[i][0] and dp[0][j]?
In edit distance, what are dp[i][0] and dp[0][j]?
- A.Both 0
- B.Both 1
- C.i and j: delete all i letters, or insert all j letters
- D.Infinity
Answer & explanation
Correct answer: i and j: delete all i letters, or insert all j letters
Turning a prefix of length i into an empty string takes i deletions, and the other way round takes j insertions.
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 →