Find the minimum number of operations to convert word1 into word2.
You can: insert a character, delete a character, or replace a character.
With word1 = "horse", word2 = "ros":
- horse → rorse (replace 'h' with 'r')
- rorse → rose (delete 'r')
- rose → ros (delete 'e')
- operations.
With word1 = "intention", word2 = "execution":
- intention → inention (remove 't')
- inention → enention (replace 'i' with 'e')
- enention → exention (replace 'n' with 'x')
- exention → exection (replace 'n' with 'c')
- exection → execution (insert 'u')
- operations.
Constraints: word1.length, word2.length .