mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
560 B
560 B
48. 旋转图像@2018/06/24
jzf
- 4ms
class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
int tmp;
for(size_t i=0; i<matrix.size();i++)
{
for(size_t j=i+1;j<matrix.size();j++)
{
tmp =matrix[i][j];
matrix[i][j] =matrix[j][i];
matrix[j][i] =tmp;
}
}
for(size_t i =0;i<matrix.size();i++)
{
reverse(matrix[i].begin(),matrix[i].end());
}
}
};