Skip to content

Commit 1727585

Browse files
committed
Time: 0 ms (100%), Space: 7.4 MB (26.83%) - LeetHub
1 parent f9a76ce commit 1727585

File tree

1 file changed

+17
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)