🥳【Python3】🔥 Easy Solution
Python3 Solution\npython\nclass Solution:\n    def minDistance(self, word1: str, word2: str) -> int:\n        m, n = len(word1), len(word2)\n        dp = [[0] *
**Python3 Solution**\n```python\nclass Solution:\n    def minDistance(self, word1: str, word2: str) -> int:\n        m, n = len(word1), len(word2)\n        dp = [[0] * (n + 1) for _ in range(m + 1)]\n        # base case - i steps away\n        for i in range(1, m + 1):\n            dp[i][0] = i\n        for j in range(1, n + 1):\n            dp[0][j] = j\n        # each step has four possibilities\n        for i in range(1, m + 1):\n            for j in range(1, n + 1):\n                # same character, i and j move ahead together\n                if word1[i - 1] == word2[j - 1]:\n                    dp[i][j] = dp[i - 1][j - 1]\n                # find min of insert, replace, remove a character\n                else:\n                    dp[i][j] = min(\n                        dp[i - 1][j] + 1,\n                        dp[i][j - 1] + 1,\n                        dp[i - 1][j - 1] + 1\n                    )\n        \n        return dp[m][n]\n```
['Dynamic Programming', 'Python3']