mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 15:45:40 +08:00
fix js螺旋数组
This commit is contained in:
@ -246,11 +246,11 @@ var generateMatrix = function(n) {
|
|||||||
res[row][col] = count++;
|
res[row][col] = count++;
|
||||||
}
|
}
|
||||||
// 下行从右到左(左闭右开)
|
// 下行从右到左(左闭右开)
|
||||||
for (; col > startX; col--) {
|
for (; col > startY; col--) {
|
||||||
res[row][col] = count++;
|
res[row][col] = count++;
|
||||||
}
|
}
|
||||||
// 左列做下到上(左闭右开)
|
// 左列做下到上(左闭右开)
|
||||||
for (; row > startY; row--) {
|
for (; row > startX; row--) {
|
||||||
res[row][col] = count++;
|
res[row][col] = count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user