rotate image
来源:互联网 发布:陈星网络情缘酷我音乐 编辑:程序博客网 时间:2024/06/05 05:23
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[][] matrix) { if(matrix == null || matrix.length == 0 || matrix[0].length == 0) { return ; } int len = matrix.length; for(int i = 0; i < len/2; i++) { for(int j = 0; j < (len + 1)/2; j++) { int temp = matrix[i][j]; matrix[i][j] = matrix[len-1-j][i]; matrix[len-1-j][i] = matrix[len-1-i][len-1-j]; matrix[len-1-i][len-1-j] = matrix[j][len-1-i]; matrix[j][len-1-i] = 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
- Big Data Lambda Architecture 翻译
- Gradle编译volley
- IOS开发笔记_AFN中多线程依赖
- Redis高可用开源缓存集群方案--总结自网络
- JAVA输入输出流
- rotate image
- Java中的getResourceAsStream方法
- select、poll、epoll之间的区别总结
- 黑马程序员--java基础--异常
- UVA 409 Excuses, Excuses!
- [转]树链剖分资料
- IO流
- BIM建筑信息模型(Building Information Modeling)
- ios字符串自适应rect