Untitled
unknown
plain_text
a month ago
438 B
1
Indexable
Never
class Solution { public: void rotate(vector<vector<int>>& matrix) { int len = matrix.size(); for (int i = 0; i < len; i++) { for (int j = i + 1; j < len; j++) { std::swap(matrix[i][j], matrix[j][i]); } } for (int i = 0; i < len; i++) { std::reverse(matrix[i].begin(), matrix[i].end()); } } };
Leave a Comment