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.
2 parents 6c59126 + 803060f commit dab5e66Copy full SHA for dab5e66
LeetCode/48. Rotate Image/Solution.java
@@ -0,0 +1,28 @@
1
+// https://leetcode.com/problems/rotate-image/
2
+
3
+class Solution {
4
+ public void rotate(int[][] matrix)
5
+ {
6
+ for(int i = 0; i<matrix.length; i++)
7
8
+ for(int j = i; j<matrix[0].length; j++)
9
10
+ int temp = 0;
11
+ temp = matrix[i][j];
12
+ matrix[i][j] = matrix[j][i];
13
+ matrix[j][i] = temp;
14
+ }
15
16
17
+ for(int i =0 ; i<matrix.length; i++)
18
19
+ for(int j = 0; j<matrix.length/2; j++)
20
21
22
23
+ matrix[i][j] = matrix[i][matrix.length-1-j];
24
+ matrix[i][matrix.length-1-j] = temp;
25
26
27
28
+}
0 commit comments