867. Transpose Matrix
Practice Transpose Matrix for free on NudgeCode: Easy, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Return the transpose of matrix: row i of the result is column i of the input, so an m x n matrix becomes n x m.
Example
matrix = [[1,2,3],[4,5,6]] -> [[1,4],[2,5],[3,6]]
Constraints
- 1 <= m, n <= 1000 (m rows, n columns)
- 1 <= m * n <= 10^5
- -10^9 <= matrix[i][j] <= 10^9