题解 | #顺时针旋转矩阵#
顺时针旋转矩阵
http://www.nowcoder.com/practice/2e95333fbdd4451395066957e24909cc
def rotateMatrix(self , mat: List[List[int]], n: int) -> List[List[int]]:
# write code here
if n==0 or n==1:return mat
res=[[0 for i in range(n)] for j in range(n)]
for i in range(n):
for j in range(n):
res[j][n-1-i]=mat[i][j]
return res