Skip to content

Commit bb495b9

Browse files
committed
Rotate Image solution
1 parent 9c3f058 commit bb495b9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

rotate-image/PDKhan.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
void rotate(vector<vector<int>>& matrix) {
4+
int n = matrix.size();
5+
6+
for(int i = 0; i < n; i++){
7+
for(int j = i + 1; j < n; j++){
8+
swap(matrix[i][j], matrix[j][i]);
9+
}
10+
}
11+
12+
for(int i = 0; i < n; i++)
13+
reverse(matrix[i].begin(), matrix[i].end());
14+
}
15+
};

0 commit comments

Comments
 (0)