classSolution: defrotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ row = len(matrix) col = len(matrix[0]) tmp = [[matrix[r][c] for c inrange(col)]for r inrange(row)]
for i inrange(row): for j inrange(col): matrix[i][j] = tmp[row-1-j][i]