LeetCode 솔루션 분류
[6/2] 867. Transpose Matrix
본문
867. Transpose Matrix
Easy
2013396Add to ListShareGiven a 2D integer array matrix
, return the transpose of matrix
.
The transpose of a matrix is the matrix flipped over its main diagonal, switching the matrix's row and column indices.
Example 1:
Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [[1,4,7],[2,5,8],[3,6,9]]
Example 2:
Input: matrix = [[1,2,3],[4,5,6]] Output: [[1,4],[2,5],[3,6]]
Constraints:
m == matrix.length
n == matrix[i].length
1 <= m, n <= 1000
1 <= m * n <= 105
-109 <= matrix[i][j] <= 109
관련자료
-
링크
댓글 5
학부유학생님의 댓글
- 익명
- 작성일
Python3
Runtime: 131 ms, faster than 21.67% of Python3 online submissions for Transpose Matrix.
Memory Usage: 14.7 MB, less than 55.25% of Python3 online submissions for Transpose Matrix.
Runtime: 131 ms, faster than 21.67% of Python3 online submissions for Transpose Matrix.
Memory Usage: 14.7 MB, less than 55.25% of Python3 online submissions for Transpose Matrix.
Jack님의 댓글
- 익명
- 작성일
Python3
Runtime: 144 ms, faster than 12.24% of Python3 online submissions for Transpose Matrix.
Memory Usage: 14.9 MB, less than 16.79% of Python3 online submissions for Transpose Matrix.
Runtime: 144 ms, faster than 12.24% of Python3 online submissions for Transpose Matrix.
Memory Usage: 14.9 MB, less than 16.79% of Python3 online submissions for Transpose Matrix.