💡JavaScript Solution
The Idea\n1. Use lavenshtein distance algorithm and dynamic programming implementation\n2. Build a matrix from word1 and word2, each cell represents the minimum
### The Idea\n1. Use lavenshtein distance algorithm and dynamic programming implementation\n2. Build a matrix from word1 and word2, each cell represents the minimum difference between the words up the current character\n3. Each cell is trying to become the locally minimum difference, so we have 3 options, 1 + left cell, 1 + top cell, 1 + diagonal (two characters aren\'t the same) or 0 + diagonal (two characters are the same)\n``` javascript\nvar minDistance = function(word1, word2) {\n    let dp = Array(word1.length+1).fill(null).map(()=>(Array(word2.length+1).fill(0)));\n\n    for (let i=0;i<dp.length;i++) {\n        dp[i][0] = i\n    }\n\n    for (let i=0;i<dp[0].length;i++) {\n        dp[0][i] = i\n    }\n\n    for (let i = 1;i<dp.length;i++) {\n        for (let j=1;j<dp[0].length;j++) {\n            dp[i][j] = Math.min(\n                            dp[i-1][j]+1, // left\n                            dp[i][j-1]+1, // right\n                            dp[i-1][j-1] + (word1[i-1]!=word2[j-1]?1:0) // diagonal\n                        );\n        }\n    }\n    return dp[dp.length-1][dp[0].length-1];\n};\n```
['JavaScript']