source and target. A single edit does one of three things to source:
- inserts any letter at any position;
- deletes any letter;
- replaces any letter with a different one.
Return the smallest number of edits that turns source into target.source="table", target="cable" → 1
Replacing t with c is enough.
source="sunday", target="saturday" → 3
Insert a and t after s, then replace n with r: 3 edits in total.
source="", target="go" → 2
Two insertions turn the empty string into go.
source="table", target="cable"
1
Run checks the first 3 tests in your browser. Submit checks all 135 tests on the server, hidden ones included.