We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0fbc611 commit 48cbc54Copy full SHA for 48cbc54
rotate-image/hu6r1s.py
@@ -0,0 +1,20 @@
1
+class Solution:
2
+ def rotate(self, matrix: List[List[int]]) -> None:
3
+ """
4
+ Do not return anything, modify matrix in-place instead.
5
+ [0][0] [0][1] [0][2]
6
+ [1][0] [1][1] [1][2]
7
+ [2][0] [2][1] [2][2]
8
+
9
+ [2][0] [1][0] [0][0]
10
+ [2][1] [1][1] [0][1]
11
+ [2][2] [1][2] [0][2]
12
13
+ n = len(matrix)
14
15
+ for i in range(n):
16
+ for j in range(i, n):
17
+ matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
18
19
20
+ matrix[i].reverse()
0 commit comments