Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2.
- You have the following 3 operations permitted on a word:
- Insert a character
- Delete a character
- Replace a character
- Input format
- First line will have word1.
- Second line will have word2.
- Output format
- Minimum number of operations required to convert word1 to word2.
- Constraints
- 1 <= |word1| <= 1000
- 1 <= |word2| <= 1000
- Sample Input 1
- horse
- ros
- Sample Output 1
- 3
- Explanation 1
- horse -> rorse (replace 'h' with 'r')
- rorse -> rose (remove 'r')
- rose -> ros (remove 'e')
- */
- /*
- TODO
- DP:33: striver
- https://www.youtube.com/watch?v=fJaKO8FbDdo&list=PLg0aancPZwRazLXPEW-vu517p3gXVCn0b&index=35
- */
- int editDistance(string str1, string str2)
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement