Skip to content

Commit db930c6

Browse files
authored
Create 048.Rotate-Image_v2.py
1 parent ff5f636 commit db930c6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution:
2+
def rotate(self, matrix):
3+
"""
4+
:type matrix: List[List[int]]
5+
:rtype: void Do not return anything, modify matrix in-place instead.
6+
"""
7+
N = len(matrix)
8+
for i in range(N//2):
9+
matrix[i],matrix[N-1-i] = matrix[N-1-i],matrix[i]
10+
for i in range(N):
11+
for j in range(0,i):
12+
matrix[i][j],matrix[j][i] = matrix[j][i],matrix[i][j]
13+

0 commit comments

Comments
 (0)