ALG-H002HardDynamic Programming
Minimum Text Edits
Return the minimum number of single-character insertions, deletions, or substitutions needed to transform a into b. Each operation costs one.
Contract
input a: string
input b: string
return integer
Constraints
- • 0 <= each length <= 1000
Examples
Example 1
a = "horse"
b = "ros"
→ 3
Example 2
a = "intention"
b = "execution"
→ 5
5 judge tests (2 shown above). Target complexity: O(m*n).