You are given two strings a and b of uppercase letters, A to Z.
In one operation you may insert one character into a string, delete one character from it, or replace one character with another.
Return the minimum number of operations needed to transform a into b.
Examples
Example 1
Input: a = "LOVE", b = "MOVIE"
Output: 2
Explanation: Replace L with M ("MOVE"), then insert I ("MOVIE"). That is two operations, and one is not enough.
Example 2
Input: a = "ABCDE", b = "ACE"
Output: 2
Explanation: Delete B and D.
Constraints
1≤a.length≤1000
1≤b.length≤1000
a and b contain only uppercase letters, A to Z.
Loading editor...
Log in to run your code. Your draft is saved in this browser.Log inSign up