🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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]?

  1. A.Both 0
  2. B.Both 1
  3. C.i and j: delete all i letters, or insert all j letters
  4. 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 →