Edit Distance
Updated Feb 24, 2026
Problem
Return minimum number of operations to convert word1 to word2.
Constraints
0 <= word1.length, word2.length <= 500
Examples
Example 1
Input:
{"word1": "horse", "word2": "ros"}
Output:
3
Function Signature
def minDistance(self, word1: str, word2: str) -> int
How to Submit
Implement a Solution class with a minDistance method.
Your method will be called with the input parameters and should return the answer.