\

class Solution {

public:

void rotate(vector<vector<int>>& matrix) {

int n = matrix.size();

vector<vector<int>> matrixNew(n, vector<int>(n,0));

```
for(int j = 0; j < n ; j++){
for(int i = 0; i < n ; i++){
matrixNew[i][j] = matrix[-j+(n-1)][i];
}
}
matrix = matrixNew;
}
```

};

\\