Open juneharold opened 3 months ago
Simply copying A[i][j] to AT[j][i] works.
class Solution(object): def transpose(self, A): R, C = len(A), len(A[0]) ans = [[None] * R for _ in xrange(C)] for r, row in enumerate(A): for c, val in enumerate(row): ans[c][r] = val return ans
Simply copying A[i][j] to AT[j][i] works.