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

Function flip

javascript/0861-score-after-flipping-matrix.js:23–41  ·  view source on GitHub ↗
(i, isRow)

Source from the content-addressed store, hash-verified

21 };
22
23 const flip = (i, isRow) => {
24 let start = 0;
25
26 if (isRow) {
27 while (start < ROW) {
28 grid[i][start] ^= 1;
29 start++;
30 }
31 return;
32 }
33
34 if (!isRow) {
35 while (start < COL) {
36 grid[start][i] ^= 1;
37 start++;
38 }
39 return;
40 }
41 };
42
43 for (let i = 0; i < COL; i++) {
44 if (!grid[i][0]) flip(i, true);

Callers 1

matrixScoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected