일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Substring with Concatenation of All Words
- Python
- LeetCode
- 315. Count of Smaller Numbers After Self
- iterator
- kaggle
- 밴픽
- Python Implementation
- 시바견
- 109. Convert Sorted List to Binary Search Tree
- attribute
- Regular Expression
- 컴퓨터의 구조
- Protocol
- Convert Sorted List to Binary Search Tree
- t1
- concurrency
- Decorator
- Generator
- 파이썬
- 715. Range Module
- shiba
- data science
- Class
- 30. Substring with Concatenation of All Words
- Python Code
- 프로그래머스
- DWG
- 43. Multiply Strings
- 운영체제
Archives
- Today
- Total
목록Sliding Window Maximum (1)
Scribbling
LeetCode: 239. Sliding Window Maximum
가장 먼저 떠오른 방법은 Priority Queue를 사용하는 것. Time Complexity: O(N*logN) import heapq class PriorityQueue: def __init__(self): self.pq = [] self.removals = [] def insert(self, elem): heapq.heappush(self.pq, -elem) def gettop(self): return -self.pq[0] def remove(self, elem): if elem == -self.pq[0]: heapq.heappop(self.pq) while self.removals and self.pq[0] == self.removals[0]: heapq.heappop(self.pq) heapq..
Computer Science/Coding Test
2021. 12. 23. 09:34