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

Function search

javascript/0329-longest-increasing-path-in-a-matrix.js:94–106  ·  view source on GitHub ↗
(matrix, row, rows, col, cols, memo)

Source from the content-addressed store, hash-verified

92 ); /* Time O(M) | Space O(M)*/
93
94const search = (matrix, row, rows, col, cols, memo) => {
95 const hasSeen = memo[row][col] !== 0;
96 if (hasSeen) return memo[row][col];
97
98 return dfs(
99 matrix,
100 row,
101 rows,
102 col,
103 cols,
104 memo,
105 ); /* Time O(N * M) | Space O((N * M) + HEIGHT) */
106};
107
108var dfs = (matrix, row, rows, col, cols, memo) => {
109 for (const [_row, _col] of getNeighbors(row, rows, col, cols)) {

Callers 2

longestIncreasingPathFunction · 0.70
dfsFunction · 0.70

Calls 1

dfsFunction · 0.70

Tested by

no test coverage detected