Edit Distance
Medium
Strings
String
Dynamic Programming
Min operations (insert, delete, replace) to convert word1 to word2.
Constraints
0 ≤ lengths ≤ 500
Examples
Example 1:
Input: horse
ros
Output: 3
Example 2:
Input: intention
execution
Output: 5
Example 3:
Input:
Output: a
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console