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

Function initTabu

javascript/0062-unique-paths.js:103–119  ·  view source on GitHub ↗
(row, col)

Source from the content-addressed store, hash-verified

101};
102
103var initTabu = (row, col) => {
104 const tabu = new Array(row)
105 .fill() /* Time O(ROWS) | Space O(ROWS) */
106 .map(() => new Array(col).fill(0)); /* Time O(COLS) | Space O(COLS) */
107
108 for (let _row = 0; _row < row; _row++) {
109 /* Time O(ROWS) */
110 tabu[_row][0] = 1; /* | Space O(ROWS * COLS) */
111 }
112
113 for (let _col = 0; _col < col; _col++) {
114 /* Time O(COLS) */
115 tabu[0][_col] = 1; /* | Space O(ROWS * COLS) */
116 }
117
118 return tabu;
119};
120
121/**
122 * DP - Bottom Up

Callers 1

uniquePathsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected