class Solution {
public int[][] transpose(int[][] A) {
int row=A.length;
int column=A[0].length;
int[][] B=new int[column][row];
for (int i = 0; i < row; i++) {
for (int j = 0; j < column; j++) {
B[j][i]=A[i][j];
}
}
return B;
}
}
Leetcode867. 转置矩阵
最新推荐文章于 2024-07-09 23:43:07 发布