Java + DP + Detailed Explanation + Easy to understand
Explanation:\n\n\n\n\n\n\n\n### Code:\n\n\nclass Solution {\n    public int minDistance(String word1, String word2) {\n        int l1 = word1.length();\n       
### Explanation:\n\n![image](https://assets.leetcode.com/users/images/70ee0a89-9a54-44b2-8106-70ef5054f543_1637868770.0880988.jpeg)\n![image](https://assets.leetcode.com/users/images/89dc90b2-7c8e-4aee-82c8-b4988e78ed06_1637868770.3484263.jpeg)\n![image](https://assets.leetcode.com/users/images/676e42a2-e7bd-4df2-9010-524be2f91a36_1637868769.804625.jpeg)\n\n<br/>\n\n### Code:\n\n```\nclass Solution {\n    public int minDistance(String word1, String word2) {\n        int l1 = word1.length();\n        int l2 = word2.length();\n        int[][] dp = new int[l1+1][l2+1];\n        \n        // Base cases\n        // Initializing First row\n        for(int i=0; i <= l2; i++)\n            dp[0][i] = i;        \n        // Initializing First col\n        for(int i=0; i <= l1; i++)\n            dp[i][0] = i;\n        \n        for(int i=1; i <= l1; i++){\n            for(int j=1; j <= l2; j++){\n                if(word1.charAt(i-1) == word2.charAt(j-1))\n                    dp[i][j] = dp[i-1][j-1];\n                else\n                    dp[i][j] = 1 + Math.min(dp[i-1][j-1], // replace\n                                            Math.min(dp[i-1][j], // delete\n                                                     dp[i][j-1]) // insert\n                                           ); \n            }\n        }\n        \n        return dp[l1][l2];\n    }\n}\n```
['Dynamic Programming', 'Java']