class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
int len = matrix.size();
vector<vector<int> >res;
vector<int >temp;
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
{
temp.push_back(matrix[len - j-1][i]);
}
res.push_back(temp);
temp.clear();
}
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
{
matrix[i][j] = res[i][j];
}
}
}
};