没啥思路
class Solution:def findDiagonalOrder(self, mat: List[List[int]]) -> List[int]:m=len(mat)n=len(mat[0])ret=[]if len(mat)==0:return retcount=0#m+n-1是对角线总数while count<m+n-1:#x和y的和刚好是count数#偶数为右上走if count%2==0:x=count if(count<m)else (m-1)y=count-xwhile(x>=0 and y<=n-1):ret.append(mat[x][y])x-=1y+=1#奇数左下走else:y=count if(count<n)else(n-1)x=count-ywhile(x<=m-1 and y>=0):ret.append(mat[x][y])x+=1y-=1count+=1return ret