Skip to content

Commit 6566514

Browse files
committed
solve: 48. Rotate Image in rust
Signed-off-by: rajput-hemant <rajput.hemant2001@gmail.com>
1 parent 9bdae6b commit 6566514

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
impl Solution {
2+
pub fn rotate(matrix: &mut Vec<Vec<i32>>) {
3+
let n = matrix.len();
4+
5+
for i in 0..n {
6+
for j in i..n {
7+
let temp = matrix[i][j];
8+
matrix[i][j] = matrix[j][i];
9+
matrix[j][i] = temp;
10+
}
11+
12+
matrix[i].reverse();
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)