Rotate Image
来源:互联网 发布:路径规划算法的例子 编辑:程序博客网 时间:2024/06/12 19:07
Matrix[i][j]-------->>>>Matrix[j][n - i]
每4个元素为一组相互交换。
class Solution {public: void rotate(vector<vector<int> > &matrix) { int n=matrix.size()-1; for(int i=0;i<n;i++) for(int j=i;j<n-i;j++) { int x=i,y=j; int temp=matrix[i][j],next; for(int k=0;k<4;k++) { next=matrix[y][n-x]; matrix[y][n-x]=temp; int t=x; x=y; y=n-t; temp=next; } } }};
0 0
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Rotate Image
- Swift:高级架构、流水线深度、内存延迟 转载
- Android Loader详解一:概述
- hdu 1686 Oulipo(KMP)
- Android Loader详解二:使用加载器
- 链接
- Rotate Image
- 2014川大复试c语言
- Android Loader详解三:重启与回调
- 在原springMVC的web项目中添加webservice(用的是xfire)
- VS2013—— HTTP 错误500.24
- ubuntu linux下如何使用终端命令行上网? 转载
- Android Loader详解四:回调及完整例子
- IOS中NSUserDefaults的用法
- 在VC和VS中使用条件断点