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 760ced5 commit 0d2da3dCopy full SHA for 0d2da3d
โrotate-image/wogha95.js
@@ -0,0 +1,27 @@
1
+/**
2
+ * ์ ์น(ํ๊ณผ ์ด์ ๊ตํ) ํ ํ ๋ฐ์ (๋ค์ง๊ธฐ)
3
+ *
4
+ * TC: O(N^2)
5
+ * SC: O(1)
6
+ */
7
+
8
9
+ * @param {number[][]} matrix
10
+ * @return {void} Do not return anything, modify matrix in-place instead.
11
12
+var rotate = function (matrix) {
13
+ const N = matrix.length;
14
15
+ for (let row = 0; row < N; row++) {
16
+ for (let column = row; column < N; column++) {
17
+ [matrix[row][column], matrix[column][row]] = [
18
+ matrix[column][row],
19
+ matrix[row][column],
20
+ ];
21
+ }
22
23
24
25
+ matrix[row].reverse();
26
27
+};
0 commit comments