LeetCode 48. Rotate Image
来源:互联网 发布:kali linux和centos 编辑:程序博客网 时间:2024/06/05 02:42
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 length = matrix[0].size(); for(int i = 0; i < length / 2; i ++){ swap(matrix[i],matrix[length - 1 - i]); } for(int i = 0; i < length; i ++){ for(int j = i + 1; j < length; j ++){ swap(matrix[i][j],matrix[j][i]); } } } };
0 0
- [LeetCode]48.Rotate Image
- LeetCode 48. Rotate Image
- LeetCode 48.Rotate Image
- LeetCode --- 48. Rotate Image
- [Leetcode] 48. Rotate Image
- [leetcode] 48. Rotate Image
- Leetcode 48. Rotate Image
- 48. Rotate Image LeetCode
- [LeetCode]48. Rotate Image
- leetcode 48. Rotate Image
- Leetcode 48. Rotate Image
- LeetCode 48. Rotate Image
- LeetCode *** 48. Rotate Image
- [LeetCode]48. Rotate Image
- LeetCode 48. Rotate Image
- LeetCode-48.Rotate Image
- [LeetCode] 48. Rotate Image
- LeetCode 48. Rotate Image
- 动态添加Fragment
- ssh2项目搭建注解形式
- ios控件NSTimer计时器
- w7 64位 Caffe环境配置
- springmvc配置及接值和共享
- LeetCode 48. Rotate Image
- bzoj1055 [HAOI2008]玩具取名[区间DP]
- leetcode 127. Word Ladder
- Redis 键(key) 命令
- (48)Java学习笔记——多线程 / 线程间通信 / 线程组 / 线程池 /
- 使用uploadImage.swf实现多图片上传
- 文章标题 UVALive 4670 : Dominating Patterns (AC自动机模板题)
- matlab r2012b 安装
- 使用google注册教程