일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- iterator
- Generator
- Python Implementation
- Protocol
- 시바견
- Python Code
- 43. Multiply Strings
- 운영체제
- Regular Expression
- 315. Count of Smaller Numbers After Self
- 밴픽
- Substring with Concatenation of All Words
- Class
- 109. Convert Sorted List to Binary Search Tree
- 컴퓨터의 구조
- Decorator
- 30. Substring with Concatenation of All Words
- kaggle
- DWG
- 파이썬
- 715. Range Module
- Python
- shiba
- concurrency
- 프로그래머스
- Convert Sorted List to Binary Search Tree
- data science
- t1
- attribute
- LeetCode
Archives
- Today
- Total
목록1834. Single-Threaded CPU (1)
Scribbling
LeetCode: 1834. Single-Threaded CPU
class Solution: def getOrder(self, tasks: List[List[int]]) -> List[int]: import heapq ret = [] TaskHeap = [] WaitHeap = [] for idx, task in enumerate(tasks): heapq.heappush(TaskHeap, (task[0], idx, task[1])) curTime = 0 while True: if not WaitHeap: if not TaskHeap: break startTime, idx, processTime = heapq.heappop(TaskHeap) heapq.heappush(WaitHeap, (processTime, idx, startTime)) while TaskHeap a..
Computer Science/Coding Test
2022. 3. 8. 21:26