旋转矩阵
将矩阵以二维数组的下标为值画出来,对比两个矩阵的下标变化,就能推出规律了
class Solution
{public:void rotate(vector<vector<int>> &m){int n = m.size();for (int i = 0; i < n; i++)for (int j = 0; j < i; j++)swap(m[i][j], m[j][i]);for (int i = 0; i < n; i++)reverse(m[i].begin(), m[i].end());}
};