超100% 时间题解 | #顺时针旋转矩阵#
顺时针旋转矩阵
http://www.nowcoder.com/practice/2e95333fbdd4451395066957e24909cc
首先水平中轴翻转
然后再沿正对角线翻转
class Solution: def rotateMatrix(self, mat, n): # write code here # for i in range(n//2): mat[i], mat[n-i - 1] = mat[n-i - 1], mat[i] for i in range(n): for j in range(i): mat[i][j], mat[j][i] = mat[j][i], mat[i][j] return mat