Rotate Image
来源:互联网 发布:手机淘宝强制拍摄脸部 编辑:程序博客网 时间:2024/04/29 16:48
算法:
1.由外至内旋转90°
例如 将1用21取代,21用25取代,25用5取代,5用1取代
...
class Solution {public: void rotate(vector<vector<int> > &matrix) { // Start typing your C/C++ solution below // DO NOT write int main() function int n = matrix.size(); for(int i = 0; i < n/2; ++i){ for(int j = i; j < n-1-i; ++j){ int tmp = matrix[i][j]; matrix[i][j] = matrix[n-1-j][i]; matrix[n-1-j][i] = matrix[n-1-i][n-1-j]; matrix[n-1-i][n-1-j] = matrix[j][n-1-i]; matrix[j][n-1-i] = tmp; } } }};
- 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
- 07-一个IP绑定多个域名(根据端口号不同进行绑定)
- 【转】CLS(公共语言规范)的CLSCompliant(跨语言调用)
- lightoj 1319 - Monkey Tradition 中国剩余定理(孙子定理)+poj 2891 Strange Way to Express Integers
- The Hound of the Baskervilles——10、The Letter
- ZOJ 3234 Protect the King
- Rotate Image
- Ural 1915 - Reconstruction of Bygones 模拟
- 杭电1143-Tri Tiling
- MSCS配置过程win2008
- IOS Block传值
- Ruby中类变量和实例变量的定义及继承
- Web导航条
- win2003上安装sql2008要求及域管理概念
- HDU 2046 骨牌铺方格