We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6cb1d9 commit 7c7f32dCopy full SHA for 7c7f32d
spiral-matrix/printjin-gmailcom.py
@@ -0,0 +1,14 @@
1
+class Solution:
2
+ def spiralOrder(self, matrix):
3
+ result = []
4
+ while matrix:
5
+ result += matrix.pop(0)
6
+ if matrix and matrix[0]:
7
+ for row in matrix:
8
+ result.append(row.pop())
9
+ if matrix:
10
+ result += matrix.pop()[::-1]
11
12
+ for row in matrix[::-1]:
13
+ result.append(row.pop(0))
14
+ return result
0 commit comments