mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 19:44:45 +08:00
Update 0054.螺旋矩阵.md
This commit is contained in:
@ -260,7 +260,7 @@ class Solution(object):
|
|||||||
:type matrix: List[List[int]]
|
:type matrix: List[List[int]]
|
||||||
:rtype: List[int]
|
:rtype: List[int]
|
||||||
"""
|
"""
|
||||||
if len(matrix)==0 or len(matrix[0])==0 : # 判定List是否为空
|
if len(matrix) == 0 or len(matrix[0]) == 0 : # 判定List是否为空
|
||||||
return []
|
return []
|
||||||
row, col = len(matrix), len(matrix[0]) # 行数,列数
|
row, col = len(matrix), len(matrix[0]) # 行数,列数
|
||||||
loop = min(row, col) // 2 # 循环轮数
|
loop = min(row, col) // 2 # 循环轮数
|
||||||
@ -268,7 +268,7 @@ class Solution(object):
|
|||||||
i, j =0, 0
|
i, j =0, 0
|
||||||
count = 0 # 计数
|
count = 0 # 计数
|
||||||
offset = 1 # 每轮减少的格子数
|
offset = 1 # 每轮减少的格子数
|
||||||
result = [0]*(row*col)
|
result = [0] * (row * col)
|
||||||
while loop>0 :# 左闭右开
|
while loop>0 :# 左闭右开
|
||||||
i, j = stx, sty
|
i, j = stx, sty
|
||||||
while j < col - offset : # 从左到右
|
while j < col - offset : # 从左到右
|
||||||
|
Reference in New Issue
Block a user