mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Update 48_旋转图像.md
This commit is contained in:
parent
3be2f46445
commit
3bf506ea8e
|
@ -1 +1,27 @@
|
|||
## 48. 旋转图像@2018/06/24
|
||||
|
||||
### jzf
|
||||
* 4ms
|
||||
```c++
|
||||
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());
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue
Block a user