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

Function setZeroes

javascript/0073-set-matrix-zeroes.js:9–19  ·  view source on GitHub ↗
(matrix)

Source from the content-addressed store, hash-verified

7 * @return {void} Do not return anything, modify matrix in-place instead.
8 */
9var setZeroes = function (matrix) {
10 const [rows, cols] = [matrix.length, matrix[0].length];
11 const [_row, _col] = initTabu(rows, cols); /* Space (ROWS + COLS) */
12
13 fillPlacements(
14 matrix,
15 _row,
16 _col,
17 ); /* Time O(ROWS * COLS) | Space (ROWS + COLS) */
18 setZero(matrix, _row, _col); /* Time O(ROWS * COLS) */
19};
20
21const initTabu = (rows, cols) => [
22 new Array(rows).fill(1) /* Space O(ROWS) */,

Callers

nothing calls this directly

Calls 8

fillPlacementsFunction · 0.85
setZeroFunction · 0.85
isColZeroFunction · 0.85
setEdgesToZeroFunction · 0.85
setCellsToZeroFunction · 0.85
setFirstRowZeroFunction · 0.85
setFirstColZeroFunction · 0.85
initTabuFunction · 0.70

Tested by

no test coverage detected