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 f14be0f commit dbaa78dCopy full SHA for dbaa78d
problems/python3/rotate-image.py
@@ -0,0 +1,16 @@
1
+class Solution:
2
+ def rotate(self, matrix: List[List[int]]) -> None:
3
+ l, r = 0, len(matrix[0])-1
4
+
5
+ while l<r:
6
+ top = l
7
+ bottom = r
8
+ for i in range(r-l):
9
+ topLeft = matrix[top][l+i]
10
+ matrix[top][l+i] = matrix[bottom-i][l]
11
+ matrix[bottom-i][l] = matrix[bottom][r-i]
12
+ matrix[bottom][r-i] = matrix[top+i][r]
13
+ matrix[top+i][r] = topLeft
14
+ l += 1
15
+ r -= 1
16
+ #the outer layer is finisthed, going into the inner layer
0 commit comments