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

Function canMove

javascript/0054-spiral-matrix.js:290–294  ·  view source on GitHub ↗
(matrix, row, rows, col, cols, direction)

Source from the content-addressed store, hash-verified

288};
289
290const canMove = (matrix, row, rows, col, cols, direction) => {
291 if (!isInBounds(row, rows, col, cols, direction)) return false;
292
293 return !hasSeen(matrix, row, col, direction);
294};
295
296const isInBounds = (row, rows, col, cols, direction) => {
297 const [_row, _col] = getCell(row, col, direction);

Callers 1

moveFunction · 0.70

Calls 2

hasSeenFunction · 0.85
isInBoundsFunction · 0.70

Tested by

no test coverage detected