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

Function valToPos

javascript/1260-shift-2d-grid.js:6–6  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

4
5 let posToVal = (r, c) => r * N + c;
6 let valToPos = (v) => [Math.floor(v / N), v % N];
7
8 res = [];
9 for (let i = 0; i < M; i++) res.push([]);

Callers 2

shiftGridMethod · 0.85
shiftGridFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected