题解 | #顺时针旋转矩阵#
顺时针旋转矩阵
http://www.nowcoder.com/practice/2e95333fbdd4451395066957e24909cc
public:
vector<vector<int> > rotateMatrix(vector<vector<int> > mat, int n) {
vector<vector<int>> result;
vector<int> path;
int index,indexB;
for(index=0;index<n;index++){
for(indexB=n-1;indexB>=0;indexB--){
path.emplace_back(mat[indexB][index]);
}
result.emplace_back(path);
path.clear();
}
return result;
}
};