File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,30 @@ class Solution:
171171
172172 return res
173173```
174-
174+ ``` python3
175+ class Solution :
176+ def spiralOrder (self , matrix : List[List[int ]]) -> List[int ]:
177+ r= len (matrix)
178+ if r == 0 or len (matrix[0 ])== 0 :
179+ return []
180+ c= len (matrix[0 ])
181+ res= matrix[0 ]
182+
183+ if r> 1 :
184+ for i in range (1 ,r):
185+ res.append(matrix[i][c- 1 ])
186+ for j in range (c- 2 , - 1 , - 1 ):
187+ res.append(matrix[r- 1 ][j])
188+ if c> 1 :
189+ for i in range (r- 2 , 0 , - 1 ):
190+ res.append(matrix[i][0 ])
191+
192+ M= []
193+ for k in range (1 , r- 1 ):
194+ e= matrix[k][1 :- 1 ]
195+ M.append(e)
196+
197+ return res+ self .spiralOrder(M)
198+ ```
175199-----------------------
176200<div align =" center " ><img src =https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width =500 > </img ></div >
You can’t perform that action at this time.
0 commit comments