problem
solution:
class Solution { public: vector<vector<int>> transpose(vector<vector<int>>& A) { int m = A.size(), n = A[0].size(); vector<vector<int>> res(n, vector<int>(m));//err... for(int i=0; i<m; ++i) { for(int j=0; j<n; ++j) { res[j][i] = A[i][j];//err... } } return res; } };
参考
1. Leetcode_easy_867. Transpose Matrix;
2. Grandyang;
完