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 1aef08f commit 6480e59Copy full SHA for 6480e59
rotate-image/HoonDongKang.ts
@@ -0,0 +1,22 @@
1
+/**
2
+ * [Problem]: [48] Rotate Image
3
+ * (https://leetcode.com/problems/rotate-image/)
4
+ */
5
6
+ Do not return anything, modify matrix in-place instead.
7
8
+// 시간복잡도 O(n^2)
9
+// 공간복잡도 O(1)
10
+function rotate(matrix: number[][]): void {
11
+ const length = matrix.length;
12
+
13
+ for (let i = 0; i < length; i++) {
14
+ for (let j = i + 1; j < length; j++) {
15
+ [matrix[i][j], matrix[j][i]] = [matrix[j][i], matrix[i][j]];
16
+ }
17
18
19
20
+ matrix[i].reverse();
21
22
+}
0 commit comments