일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- iterator
- 715. Range Module
- 30. Substring with Concatenation of All Words
- 컴퓨터의 구조
- Generator
- 밴픽
- Class
- kaggle
- 315. Count of Smaller Numbers After Self
- 43. Multiply Strings
- 프로그래머스
- 109. Convert Sorted List to Binary Search Tree
- attribute
- concurrency
- Protocol
- Convert Sorted List to Binary Search Tree
- t1
- Substring with Concatenation of All Words
- 파이썬
- Regular Expression
- 운영체제
- DWG
- shiba
- Decorator
- LeetCode
- Python
- Python Code
- Python Implementation
- 시바견
- data science
Archives
- Today
- Total
목록2034. Stock Price Fluctuation (1)
Scribbling
LeetCode: 2034. Stock Price Fluctuation
1. Using heaps with lazy removal Below code uses 'MyHeap' data structure, a heap with lazy removal. Lazy removal here means, if we have to remove an element, we handle it by using another heap as a trash can. import heapq class MyHeap: def __init__(self, type='min'): self.heap = [] self.removals = [] self.sign = 1 if type == 'min' else -1 def insert(self, elem): heapq.heappush(self.heap, self.si..
Computer Science/Coding Test
2022. 3. 23. 10:59