Swap Rows and Columns
Return the transpose of the 2-D array grid: a table where the rows of grid become the columns. If grid has 2 rows and 3 columns, the answer has 3 rows and 2 columns, and result[j][i] == grid[i][j].
Example 1
grid [[1,2,3],[4,5,6]]
returns [[1,4],[2,5],[3,6]]
The answer is [[1, 4], [2, 5], [3, 6]].
Constraints
1 <= rows, columns <= 10
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Third QuartileBeginner
- Votes TallyBeginner
- Add Column OffsetsEasy
- Age GroupsEasy
- All DifferentEasy
- Average of Chosen RowsEasy
- Average of Top ThreeEasy
- Biggest JumpEasy