Skip to content

Commit 9f0e528

Browse files
committed
leetcode.com 48. Rotate Image
문제 링크: https://leetcode.com/problems/rotate-image
1 parent f551175 commit 9f0e528

File tree

1 file changed

+16
-0
lines changed
  • leetcode.com 48. Rotate Image

1 file changed

+16
-0
lines changed

leetcode.com 48. Rotate Image/main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from typing import List
2+
3+
4+
class Solution:
5+
def rotate(self, matrix: List[List[int]]) -> None:
6+
tmp = [[0 for _ in range(len(matrix[0]))] for _ in range(len(matrix))]
7+
n = len(matrix)
8+
9+
for r in range(len(matrix)):
10+
for c in range(len(matrix)):
11+
v = matrix[r][c]
12+
tmp[c][n - r - 1] = v
13+
14+
for r in range(len(matrix)):
15+
for c in range(len(matrix)):
16+
matrix[r][c] = tmp[r][c]

0 commit comments

Comments
 (0)