Dynamic programming · 9 / 15 Exercise Hard

Edit distance

Objective

The edit distance (Levenshtein) is the smallest number of operations to turn one string into another, where each operation is inserting, deleting or replacing a character. It is used in spell checkers and approximate searches.

Instructions

  • Read two lines of text (no spaces, not empty).
  • Show Distance: n.
Input
kitten
sitting
Output
Distance: 3

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise