题目
新建一个等大小的数组,然后换一种形式为原先的数组赋值
1234567891011121314
public void rotate(int[][] matrix) { int[][] tmp = new int[matrix.length][matrix.length]; for(int i=0;i<matrix.length;i++) { for(int j=0;j<matrix.length;j++) { tmp[i][j] = matrix[i][j]; } } for(int i=0;i<matrix.length;i++) { for(int j=0;j<matrix.length;j++) { matrix[j][matrix.length-i-1] = tmp[i][j]; } }}
lyhcc
DT Developer
Hunan,China
Posts
86
Categories
23
Tags
81
BigData / Hadoop
others
Linux
SoftwareTesting
Java设计模式
Update your browser to view this website correctly. Update my browser now
×