spiral order matrix
1m = [[1,2,3],
2 [4,5,6],
3 [7,8,9]]
4
5def spiralOrder(m):
6 return m and [*m.pop(0)] + spiralOrder([*zip(*m)][::-1])
7
8spiralOrder(m)
See also:
1m = [[1,2,3],
2 [4,5,6],
3 [7,8,9]]
4
5def spiralOrder(m):
6 return m and [*m.pop(0)] + spiralOrder([*zip(*m)][::-1])
7
8spiralOrder(m)
See also: