using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param mat int整型二维数组 * @param n int整型 * @return int整型二维数组 */ public List<List<int>> rotateMatrix (List<List<int>> mat, int n) { // write code here for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { int nTmp = mat[i][j]; mat[i][j] = mat[j][i]; mat[j][i] = nTmp; } } for (int i = 0; i < n; i++) mat[i].Reverse(); return mat; } }