import java.util.*; public class Transform { public int[][] transformImage(int[][] matrix, int n) { // write code here n = matrix.length; int limit = (n-1)/2; for(int i=0;i<=limit; i++){ for(int j=i;j<n-i-1;j++){ int temp = matrix[i][j]; matrix[i][j] = matrix[n-1-j][i]; matrix[n-1-j][i] = matrix[n-1-i][n-1-j]; matrix[n-1-i][n-1-j] = matrix[j][n-1-i]; matrix[j][n-1-i] = temp; } } return matrix; } }
时间: 2024-10-13 22:53:33