标签:
代码:
public class Solution { public void rotate(int[][] matrix) { int n = matrix.length; for(int i = 0; i < n/2; i++){ int num = n-i*2; for(int j = 0; j < num-1; j++){ int temp = matrix[i][i+j]; matrix[i][i+j] = matrix[i+num-1-j][i]; matrix[i+num-1-j][i] = matrix[i+num-1][i+num-1-j]; matrix[i+num-1][i+num-1-j] = matrix[i+j][i+num-1]; matrix[i+j][i+num-1] = temp; } } } }
Jan 17 - Rotate Image; 2D Array; xPos and yPos;
标签:
原文地址:http://www.cnblogs.com/5683yue/p/5138932.html