题解 | #最长回文子串#
顺时针旋转矩阵
http://www.nowcoder.com/practice/2e95333fbdd4451395066957e24909cc
首先是旋转90度,很难想到每个位置转移对应的位置发生了变化是多少:(x,y)->(y,n-x-1)
[[0]n for e in range(n)]为什么不能写成[[0]n]*n?????
class Solution: def rotateMatrix(self, mat, n): # write code here a = [[0]*n for e in range(n)]//暂时没有搞懂,欢迎留言交流 # print (a) for i in range(n): for j in range(n): # x += ((mat[i][j] and ob111111111) < 9) a[j][n-1-i] = mat[i][j] return a