Skip to content

Commit 0646ed0

Browse files
aQuaaQua
aQua
authored and
aQua
committed
54 finish
1 parent c70d79d commit 0646ed0

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Algorithms/0054.spiral-matrix/spiral-matrix.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ func spiralOrder(matrix [][]int) []int {
88
}
99

1010
c := len(matrix[0])
11-
11+
if c == 0 {
12+
return []int{}
13+
}
14+
1215
if len(matrix) == 1 {
1316
return matrix[0]
1417
}

Algorithms/0054.spiral-matrix/spiral-matrix_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ func Test_Problem0054(t *testing.T) {
2727

2828
qs := []question{
2929

30+
question{
31+
para{
32+
[][]int{
33+
[]int{},
34+
[]int{},
35+
[]int{},
36+
},
37+
},
38+
ans{
39+
[]int{},
40+
},
41+
},
42+
3043
question{
3144
para{
3245
[][]int{

0 commit comments

Comments
 (0)