MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / initMemo

Function initMemo

javascript/0072-edit-distance.js:96–101  ·  view source on GitHub ↗
(word1, word2)

Source from the content-addressed store, hash-verified

94};
95
96var initMemo = (word1, word2) =>
97 new Array(word1.length)
98 .fill() /* Time O(N) | Space O(N) */
99 .map(() =>
100 new Array(word2.length).fill(-1),
101 ); /* Time O(N) | Space O(N) */
102
103var dfs = (word1, word2, i, j, memo) => {
104 const isEqual = word1[i] === word2[j];

Callers 1

minDistanceFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected