일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 영어공부
- 링피트
- 화상영어
- 리얼 클래스
- 운동
- 3줄정리
- Daily Challenge
- 10분
- 영어원서읽기
- leetcode
- 쓰릴오브파이트
- 괜찮음
- 스탭퍼
- 파비최
- 매일
- Problem Solving
- 뭐든
- 월간
- English
- 사이드
- FIT XR
- 개발자
- realclass
- 읽기
- 프로젝트
- 잡생각
- Writing
- 30분
- 만화도
- 미드시청
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/course-schedule-iii/
Course Schedule III - LeetCode
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 scheduleCourse(self, courses: List[List[int]]) -> int:
courses.sort(key=lambda c: c[1])
A, curr = [], 0
for dur, ld in courses:
heapq.heappush(A,-dur)
curr += dur
if curr > ld: curr += heapq.heappop(A)
return len(A)
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
Today's Challenge (0) | 2022.06.25 |
---|---|
Today's Challenge (0) | 2022.06.24 |
Today's Challenge (0) | 2022.06.22 |
Today's Challenge (0) | 2022.06.21 |
Today's Challenge (0) | 2022.06.20 |
Comments