Leetcode 48 Rotated Image
来源:互联网 发布:eddie griffin 知乎 编辑:程序博客网 时间:2024/06/09 11:43
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) { for(int i = 0; i < matrix.length; i ++){ for(int j = i; j< matrix[0].length; j++){ int temp = matrix[i][j]; matrix[i][j] = matrix[j][i]; matrix[j][i] = temp; } } for(int i = 0; i < matrix.length; i ++){ for(int j = 0; j< matrix.length/2; j++){ int temp = matrix[i][j]; matrix[i][j] = matrix[i][matrix.length - j - 1]; matrix[i][matrix.length - j - 1] = temp; } } }}
阅读全文
0 0
- Leetcode 48 Rotated Image
- 【Leetcode】Rotate Image (Rotated)
- [leetcode 48] Rotate Image
- [LeetCode 48]Rotate Image
- leetcode || 48、Rotate Image
- leetcode-48 Rotate Image
- Rotate Image - LeetCode 48
- 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
- LeetCode 48 Rotate Image
- [系统装机]如何用UltraISO制作U盘启动盘——图文详解
- Struts2环境搭建--SSH环境搭建--Spring MVC 环境搭建
- 前端涉及的所有知识体系
- 关于命令行解释器shell输入输出重定向的一些理解
- pic操作lcd 模拟spi 9非标准spi 9位数据位
- Leetcode 48 Rotated Image
- SDUT-3930(线段树+状压)
- java开发环境搭建
- LeetCode@Array_169_Majority_Element
- 五、Netty5解决TCP粘包问题
- 展讯平台判断otg状态
- 傅盛认知三部曲之三:战略就是格局+破局
- 深入理解AJAX系列第三篇--async属性值之同步和异步及同步和异步区别
- 一个想法照进现实-《IT连》创业项目:直觉型面试招聘的Bug