class Solution:def spiralMatrixIII(self, rows, cols, rStart, cStart):# 初始化结果列表并将起始位置加入结果res = [(rStart, cStart)] # 如果结果列表的长度等于总的单元格数,直接返回结果 if rows * cols == 1: return res # 初始化步长和方向 step = 1 dirs = [(0, 1), (1, 0), (0, -1), (-1, 0)] # 右、下、左、上 r, c = rStart, cStart di = 0 # 当前方向索引 # 循环直到结果列表的长度等于总的单...