标签:
public class Solution { public void rotate(int[][] matrix) { if (matrix == null || matrix.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 tmp = matrix[i][j]; matrix[i][j] = matrix[len - j - 1][i]; matrix[len - j - 1][i] = matrix[len - i - 1][len - j - 1]; matrix[len - i - 1][len - j - 1] = matrix[j][len - i - 1]; matrix[j][len - i - 1] =tmp; } } } }
标签:
原文地址:http://www.cnblogs.com/77rousongpai/p/4523633.html