Update 48_旋转图像.md

pull/46/head
JZFamily 2018-06-24 12:42:12 +08:00 committed by GitHub
parent 3be2f46445
commit 3bf506ea8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -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());
}
}
};
```