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

Function addTop

javascript/0054-spiral-matrix.js:66–73  ·  view source on GitHub ↗
(matrix, top, bot, left, right, order)

Source from the content-addressed store, hash-verified

64};
65
66var addTop = (matrix, top, bot, left, right, order) => {
67 for (let col = left; col <= right; col++) {
68 /* Time O(COLS) */
69 order.push(
70 matrix[top][col],
71 ); /* Ignore Auxilary Spsace O(ROWS * COLS) */
72 }
73};
74
75var addRight = (matrix, top, bot, left, right, order) => {
76 for (let row = top; row <= bot; row++) {

Callers 2

spiralOrderFunction · 0.85
traverseFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected