48. Rotate Image
来源:互联网 发布:linux启动终端快捷键 编辑:程序博客网 时间:2024/05/06 10:55
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?
public class Solution { public void rotate(int[][] A) { int l = A.length; if(l < 2) return; for(int i = 0;i <= (l-1)/2;i++){ for(int j = i;j < l-1-i;j++){ int tmp = A[i][j]; A[i][j] = A[l-1-j][i]; //每四个位置组成了一个循环 A[l-1-j][i] = A[l-1-i][l-1-j]; A[l-1-i][l-1-j] = A[j][l-1-i]; A[j][l-1-i] = tmp; } } }}
0 0
- [LeetCode]48.Rotate Image
- LeetCode 48. Rotate Image
- LeetCode 48.Rotate Image
- LeetCode --- 48. Rotate Image
- [Leetcode] 48. Rotate Image
- 48. Rotate Image
- 48. Rotate Image
- 48. Rotate Image
- 48. Rotate Image
- [leetcode] 48. Rotate Image
- Leetcode 48. Rotate Image
- 48. Rotate Image LeetCode
- [LeetCode]48. Rotate Image
- 48. Rotate Image
- 48. Rotate Image
- leetcode 48. Rotate Image
- Leetcode 48. Rotate Image
- LeetCode 48. Rotate Image
- 基于Spring可扩展Schema提供自定义配置支持
- Mac(OS X)安装、配置并使用MySQL数据库
- Python 字符串
- LeetCode 235 Lowest Common Ancestor of a Binary Search Tree(二叉搜索树的最小公共祖先)
- 杭电1259ZJUTACM
- 48. Rotate Image
- zip I/O error: Permission denied zip error: Could not create output file (/mnt/e/backup/201601120144
- 【tyvj1313】烽火传递
- Android加载图片内存溢出问题解决方法
- 深入PHP多态的实现
- Date,SimpleDateFormat,Calendar 类的应用
- 如何使用Settings.bundle
- 解决can't connect to MySQL server on 'localhost'(10061)问题
- Java 文件读取