Transpose Matrix
转置矩阵. 常规操作
class Solution {
public int[][] transpose(int[][] A) {
int[][] res = new int[A[0].length][A.length];
int row = 0;
int col = 0;
for(int i = 0; i < A.length; i++) {
for(int j = 0; j < A[0].length; j++) {
res[row++][col] = A[i][j];
}
row = 0;
col++;
}
return res;
}
}