Problem
Return the minimum number of single-character edits needed to turn string a into string b. An edit is one of: insert a character, delete a character, or replace a character.
Example 1
- Input
- a = "horse", b = "ros"
- Output
- 3
- Why
- horse → rorse → rose → ros
Example 2
- Input
- a = "kitten", b = "sitting"
- Output
- 3
Example 3
- Input
- a = "", b = "abc"
- Output
- 3
- Why
- insert all three
Constraints
0 <= a.length, b.length <= 500Both strings contain only lowercase letters.