JavaScript Clean Recursive DP
javascript\nvar minDistance = function(word1, word2) {\n    const memo = new Map();\n    \n    function run(w1, w2) {\n        if(memo.has(`${w1}-${w2}`)) retur
```javascript\nvar minDistance = function(word1, word2) {\n    const memo = new Map();\n    \n    function run(w1, w2) {\n        if(memo.has(`${w1}-${w2}`)) return memo.get(`${w1}-${w2}`)\n        if(w1 >= word1.length && w2 >= word2.length) return 0;\n        \n        // if it\'s a match\n        if(word1[w1] === word2[w2]) return run(w1+1, w2+1);\n        \n        let insert = Infinity, del = Infinity, replace = Infinity;\n        \n        // insert\n        if(w2 < word2.length) insert = run(w1, w2+1);\n        \n        // delete\n        if(w1 < word1.length) del = run(w1+1, w2);\n        \n        // replace\n        if(w1 < word1.length && w2 < word2.length) replace = run(w1+1, w2+1);\n        \n        const res = Math.min(insert, del, replace) + 1;\n        memo.set(`${w1}-${w2}`, res);\n        return res;\n    }\n    return run(0, 0)\n};\n```
['Dynamic Programming', 'Memoization', 'JavaScript']