Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- dacon
- programmers
- 더현대서울 맛집
- 백준
- github
- gs25
- 코로나19
- AI 경진대회
- Git
- SW Expert Academy
- 프로그래머스 파이썬
- 편스토랑 우승상품
- Real or Not? NLP with Disaster Tweets
- 우분투
- Baekjoon
- 캐치카페
- ChatGPT
- PYTHON
- 파이썬
- 프로그래머스
- 맥북
- ubuntu
- leetcode
- Docker
- 금융문자분석경진대회
- Kaggle
- 자연어처리
- 편스토랑
- hackerrank
- 데이콘
Archives
- Today
- Total
솜씨좋은장씨
[leetCode] 867. Transpose Matrix (Python) 본문
728x90
반응형
Given a matrix A, return the transpose of A.
The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix.
Example 1:
Input: [[1,2,3],[4,5,6],[7,8,9]]
Output: [[1,4,7],[2,5,8],[3,6,9]]
Example 2:
Input: [[1,2,3],[4,5,6]]
Output: [[1,4],[2,5],[3,6]]
Note:
- 1 <= A.length <= 1000
- 1 <= A[0].length <= 1000
Solution
class Solution:
def transpose(self, A: List[List[int]]) -> List[List[int]]:
return list(map(list, zip(*A)))
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[leetCode] 1394. Find Lucky Integer in an Array (Python) (0) | 2020.11.11 |
---|---|
[leetCode] 81. Search in Rotated Sorted Array II (Python) (0) | 2020.11.10 |
[leetCode] 43. Multiply Strings (Python) (0) | 2020.11.08 |
[leetCode] 1299. Replace Elements with Greatest Element on Right Side (Python) (0) | 2020.11.07 |
[leetCode] 1122. Relative Sort Array (Python) (0) | 2020.11.06 |
Comments