28Edit Distance
Harddynamic programmingstrings
Write edit_distance(a, b) that returns the smallest number of single-character edits needed to turn a into b.
An edit is inserting a character, deleting a character, or replacing one character with another. For example kitten → sitting takes 3 edits.
Examples
Example 1
>>> edit_distance('kitten', 'sitting') 3
Example 2
>>> edit_distance('horse', 'ros') 3
Run examples checks the 2 examples above. Submit runs all 7 tests, including hidden edge cases, and marks the challenge solved.