일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- leetcode
- 링피트
- 영어공부
- 읽기
- 매일
- 운동
- Problem Solving
- 월간
- 뭐든
- 화상영어
- 영어원서읽기
- Writing
- 3줄정리
- 미드시청
- English
- 개발자
- 리얼 클래스
- 쓰릴오브파이트
- 30분
- 사이드
- Daily Challenge
- 파비최
- FIT XR
- realclass
- 프로젝트
- 괜찮음
- 스탭퍼
- 만화도
- 잡생각
- 10분
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.09.18 Today's Challenge 본문
https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/
LeetCode - The World's Leading Online Programming Learning Platform
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
매우 간단했던 문제!!!
class Solution:
def kWeakestRows(self, mat: List[List[int]], k: int) -> List[int]:
d = {}
idx = 0
for m in mat:
d[idx] = sum(m)
idx += 1
d = sorted(d.items(), key=lambda item: item[1])
res = []
for r in d:
res.append(r[0])
return res[:k]
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
2023.09.20 Today's Challenge (0) | 2023.09.20 |
---|---|
2023.09.19 Today's Challenge (0) | 2023.09.19 |
2023.09.17 Today's Challenge (0) | 2023.09.17 |
2023.09.16 Today's Challenge (0) | 2023.09.16 |
2023.09.15 Today's Challenge (0) | 2023.09.15 |
Comments