1. 题目原址
https://leetcode.com/problems/transpose-matrix/
2. 题目描述
3. 题目大意
给定一个二维数组,将二维数组转置
4. 解题思路
签到题
5. AC代码
class Solution {
public int[][] transpose(int[][] A) {
int length = A.length;
int [][] ret = new int[A[0].length][length];
for(int i = 0; i < length; i++) {
for(int j = 0; j < A[0].length; j++) {
ret[j][i] = A[i][j];
}
}
return ret;
}
}