Skip to content

Commit 25caf40

Browse files
AE-Hertzidoocs
authored andcommitted
style: format code and docs with prettier
1 parent 18cd1ac commit 25caf40

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

solution/0800-0899/0885.Spiral Matrix III/Solution.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,36 @@
55
* @param {number} cStart
66
* @return {number[][]}
77
*/
8-
var spiralMatrixIII = function(rows, cols, rStart, cStart) {
8+
var spiralMatrixIII = function (rows, cols, rStart, cStart) {
99
let result = [];
1010
let totalCells = rows * cols;
11-
let directions = [[0, 1], [1, 0], [0, -1], [-1, 0]];
11+
let directions = [
12+
[0, 1],
13+
[1, 0],
14+
[0, -1],
15+
[-1, 0],
16+
];
1217
let step = 0;
13-
let d = 0;
14-
let r = rStart, c = cStart;
15-
18+
let d = 0;
19+
let r = rStart,
20+
c = cStart;
21+
1622
result.push([r, c]);
17-
23+
1824
while (result.length < totalCells) {
1925
if (d === 0 || d === 2) step++;
20-
26+
2127
for (let i = 0; i < step; i++) {
2228
r += directions[d][0];
2329
c += directions[d][1];
24-
30+
2531
if (r >= 0 && r < rows && c >= 0 && c < cols) {
2632
result.push([r, c]);
2733
}
2834
}
29-
35+
3036
d = (d + 1) % 4;
3137
}
32-
38+
3339
return result;
3440
};

0 commit comments

Comments
 (0)