class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
reverse(begin(matrix), end(matrix));
for (int i = 0; i < matrix.size(); ++i)
for (int j = i + 1; j < matrix.size(); ++j)
swap(matrix[i][j], matrix[j][i]);
}
};
leetcode
challenge
Here is the link for the problem:
https://leetcode.com/problems/rotate-image/
Top comments (0)