Skip to content

Commit

Permalink
Time: 0 ms (100%), Space: 41.9 MB (88.03%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit-S-Sahu committed Oct 23, 2024
1 parent efcf6aa commit db24598
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 0048-rotate-image/0048-rotate-image-brute_force.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Solution {
public void rotate(int[][] matrix) {
int n = matrix.length;
int res[][] = new int[n][n];

for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
res[j][n - 1 - i] = matrix[i][j];
}
}

for(int i= 0; i < n; i++){
for(int j = 0; j < n; j++){
matrix[i][j] = res[i][j];
}
}

}
}

0 comments on commit db24598

Please sign in to comment.