Java Top Down + Memo
\nclass Solution {\n    public int minDistance(String word1, String word2) {\n        final int m = word1.length();\n        final int n = word2.length();\n    
```\nclass Solution {\n    public int minDistance(String word1, String word2) {\n        final int m = word1.length();\n        final int n = word2.length();\n        final int[][] memo = new int[m][n];\n        \n        return minDistHelper(word1, word2, m, n, memo);\n    }\n    \n    private int minDistHelper(String word1, String word2, int m, int n, int[][] memo) {\n        \n        if(m == 0) {\n            return n;\n        }\n        \n        if(n == 0) {\n            return m;\n        }\n        \n        if(memo[m - 1][n - 1] != 0) {\n            return memo[m - 1][n - 1];\n        }\n        \n        if(word1.charAt(m - 1) == word2.charAt(n - 1)) {\n            return minDistHelper(word1, word2, m - 1, n - 1, memo);\n        }\n        \n        int insert = minDistHelper(word1, word2, m, n - 1, memo);\n        int remove = minDistHelper(word1, word2, m - 1, n, memo);\n        int replace = minDistHelper(word1, word2, m - 1, n - 1, memo);\n        \n        memo[m - 1][n - 1] = 1 + Math.min(insert, Math.min(remove, replace));\n        return memo[m - 1][n - 1];\n    }\n}\n```
[]