package code; /* * 48. Rotate Image * 题意:将数组顺时针翻转90度 * 难度:Medium * 分类:Array * 思路:两种思路:先对角,再以竖轴对称;先以横轴对称,再对角.思路很新奇,记一下. */ public class lc48 { public static void main(String[] args) { int[][] matrix = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; printArr(matrix); rotate(matrix); System.out.println(); printArr(matrix); } public static void rotate(int[][] matrix) { for (int i = 0; i