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

Function getNeighbors

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

Source from the content-addressed store, hash-verified

46};
47
48var getNeighbors = (row, rows, col, cols) =>
49 [
50 [0, 1],
51 [0, -1],
52 [1, 0],
53 [-1, 0],
54 ]
55 .map(([_row, _col]) => [row + _row, col + _col])
56 .filter(
57 ([_row, _col]) =>
58 0 <= _row && _row < rows && 0 <= _col && _col < cols,
59 );
60
61/**
62 * DP - Top Down

Callers 3

dfsFunction · 0.70
buildGraphFunction · 0.70
checkNeighborsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected