```
class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
int num = matrix.size()/2;
int b = matrix.size();
for (int i = 0; i< num; i++){
for (int j = i; j<(b-i-1); j++){
swap(matrix[i][j], matrix[j][b-i-1]);
swap(matrix[i][j], matrix[b-i-1][b-j-1]);
swap(matrix[i][j], matrix[b-j-1][i]);
}
}
}
};
```