1 2 3 4 5 6 7 8 9 10 11 12 13
| class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ for i in range(len(matrix)): # 列长度 for j in range(i+1, len(matrix)): # 镜像反转 matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j] for i in matrix: print i for i in range(len(matrix)): # 前后翻转 matrix[i].reverse()
|