leetcode - Rotate Image
来源:互联网 发布:淘宝哪家stussy是真的 编辑:程序博客网 时间:2024/04/29 13:22
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(std::vector<std::vector<int> > &matrix) {int n = matrix.size();int m = n / 2; for(int i = 0; i < m; i++){for(int j = i; j < n - 1 - i; j++){ int temp = matrix[j][i]; matrix[j][i] = matrix[n - 1 - i][j];matrix[n - 1 - i][j] = matrix[n - 1 - j][n - 1 - i];matrix[n - 1 - j][n - 1 - i] = matrix[i][n - 1 - j];matrix[i][n - 1 - j] = temp;}}}};
0 0
- LeetCode: Rotate Image
- [Leetcode] Rotate Image
- LeetCode : Rotate Image
- [LeetCode] Rotate Image
- leetcode 67: Rotate Image
- [leetcode] Rotate Image
- [Leetcode] Rotate Image
- [LeetCode]Rotate Image
- LeetCode-Rotate Image
- [leetcode] Rotate Image
- LeetCode - Rotate Image
- leetcode之Rotate Image
- LeetCode - Rotate Image
- Leetcode: Rotate Image
- LeetCode:Rotate Image
- Leetcode: Rotate Image
- Leetcode Rotate Image
- leetcode Rotate Image
- 截图
- Mac OS启动服务优化高级篇(launchd tuning)
- kmeans聚类及Matlab实现
- mysql的show命令使用方法// git常用命令
- 苹果关于TestFlight Beta Testing简介和细节信息
- leetcode - Rotate Image
- Android文件读写操作大全
- C 语言 int 读写是否需要加锁
- 温故而知新 知识整理之Bitmap相关类ExifInterface
- linux gem install mongo Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or u
- 【设计经验传承】图标设计初阶要先型
- JavaScript parse() 方法
- 网址学习汇总----图像识别与跟踪
- TestFlight FAQ