Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def findDiagonalOrder(self, nums: List[List[int]]) -> List[int]:
- arr = []
- l = len(nums)
- d = {}
- for i in range(l):
- for j in range(len(nums[i])):
- if(i+j not in list(d.keys())):
- d[i+j] = []
- d[i+j].append(nums[i][j])
- for key in list(d.keys()):
- diag = d[key]
- l = len(diag)
- for i in range(l)[::-1]:
- arr.append(diag[i])
- return arr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement