Rotate Image
来源:互联网 发布:python datetime 微秒 编辑:程序博客网 时间:2024/05/16 01:08
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?
#include<iostream>#include<vector>#include<algorithm>using namespace std;//先求转置.void rotate(vector<vector<int> > &matrix) {for (int i = 0; i != matrix.size();++i){for (int j = i+1; j != matrix[0].size();++j){swap(matrix[i][j], matrix[j][i]);}reverse(matrix[i].begin(), matrix[i].end());}}
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
- Boosting与Gradient Boosting
- Eclipse中 SVN插件的使用
- Codeforces 527D - Clique Problem
- __VA_ARGS__用法
- Android最火的GitHub开源项目(二)
- Rotate Image
- 数据库三个范式的理解
- opencv摄像头设备采集问题
- 查看 Andoird Native 内存变化 内存泄漏检查
- 锁定首行和首列
- iOS学习笔记(十六)——数据库操作(使用FMDB)
- 解决android sdk manager google无法下载问题
- 纯英文环境下安装ubuntu的Fcitx输入法的安装-转
- Kafka剖析(一):Kafka背景及架构介绍