DEV Community

Discussion on: Solution: Rotate Image

Collapse
 
danielhao5 profile image
Daniel Hao

It can be solved using the zip + reversed(matrix) like

def rotate(matrix):
'''in-place rotate'''
matrix[:] = [list(r) for r in zip(*reversed(matrix))]