Data Structures & AlgorithmsModerateGATE CS · ICPC regional

What is the edit distance (Levenshtein distance with insertion, deletion and substitution each costing 1) between intention and execution?

  1. A. 6
  2. B. 4
  3. C. 7
  4. D. 5

Correct answer: D. 5

Fill the standard DP table where dp[i][j] depends on the three neighbours, and the answer is the bottom-right cell. Substitution cost is 1 here, not 2.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic