Rotate Image
来源:互联网 发布:手机破解压缩文件软件 编辑:程序博客网 时间:2024/05/01 05:43
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
class Solution {public: void rotate(vector<vector<int> > &matrix) { int n=matrix.size(); for(int i=0;i<n;i++) for(int j=0;j<n-i;j++){ int temp=matrix[i][j]; matrix[i][j]=matrix[n-1-j][n-1-i]; matrix[n-1-j][n-1-i]=temp; } for(int i=0;i<n/2;i++) for(int j=0;j<n;j++){ int temp=matrix[i][j]; matrix[i][j]=matrix[n-i-1][j]; matrix[n-i-1][j]=temp; } }};
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
- IE6 PNG透明终极解决方案
- ffmpeg解复用视频文件
- C语言可变参数宏定义方法
- 怎么会有种新车报废的感觉 粉红色奥拓报废之旅
- Android四大组件之Activity
- Rotate Image
- 四旋翼飞行器Quadrotor飞控之 PID调节(参考APM程序)
- libusb异步中断传输使用说明
- hdu-oj 1390 Binary Numbers
- CATALINA_HOME和CATALINA_BASE 区别
- 使用AsyncTask任务
- .net 开发微信公众平台(三)-----发送图文消息
- CSS和SVG中的剪切——clip-path属性和<clipPath>元素
- POJ 3641 Pseudoprime numbers Miller Rabin算法