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 59828da commit 59429eaCopy full SHA for 59429ea
Leetcode/rotate_image.py
@@ -0,0 +1,16 @@
1
+# 48. Rotate Image
2
+
3
+class Solution:
4
+ def rotate(self, matrix: List[List[int]]) -> None:
5
+ """
6
+ Do not return anything, modify matrix in-place instead.
7
8
+ n = len(matrix)
9
10
+ for i in range(n):
11
+ for j in range(i, n):
12
+ matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
13
14
15
+ for j in range(n // 2):
16
+ matrix[i][j], matrix[i][(n-1)-j] = matrix[i][(n-1)-j], matrix[i][j]
0 commit comments