import java.util.*; public class Solution { public int[][] rotateMatrix(int[][] mat, int n) { // write code here int row = mat.length; int col = mat[0].length; int[][] res = new int[mat.length][mat[0].length]; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { res[i][j] = mat[row - 1 - j][i]; } } return res; } }