Edit Distance
Hard
dynamic-programming
Google
Meta
Jane Street
Compute the minimum number of operations (insert, delete, replace) to convert one string to another.
Example
edit_distance("horse", "ros")
# => 3
edit_distance("intention", "execution")
# => 5
Test Cases
Python Editor
Output
Click "Run" to see results...