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 8dc94c3 commit 27e4c4cCopy full SHA for 27e4c4c
rotate-image/evan.py
@@ -0,0 +1,18 @@
1
+from typing import List
2
+
3
4
+class Solution:
5
+ def rotate(self, matrix: List[List[int]]) -> None:
6
+ """
7
+ Do not return anything, modify matrix in-place instead.
8
9
+ n = len(matrix)
10
11
+ # Step 1: Transpose the matrix
12
+ for i in range(n):
13
+ for j in range(i, n):
14
+ matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
15
16
+ # Step 2: Reverse each row
17
18
+ matrix[i].reverse()
0 commit comments