题目:
解答:
1 class Solution { 2 public: 3 vector<vector<int>> transpose(vector<vector<int>>& A) 4 { 5 int ro = A.size(); 6 int co = A[0].size(); 7 8 vector<vector<int>> res(co); 9 for (int i = 0; i < co; ++i) 10 { 11 for (int j = 0; j < ro; ++j) 12 { 13 res[i].emplace_back(A[j][i]); 14 } 15 } 16 return res; 17 } 18 };