일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- kaggle
- 파이썬
- Generator
- Python Code
- Convert Sorted List to Binary Search Tree
- data science
- 컴퓨터의 구조
- LeetCode
- t1
- shiba
- 315. Count of Smaller Numbers After Self
- Protocol
- Class
- 715. Range Module
- iterator
- Substring with Concatenation of All Words
- Regular Expression
- attribute
- Python Implementation
- 30. Substring with Concatenation of All Words
- DWG
- Python
- 프로그래머스
- 밴픽
- 43. Multiply Strings
- concurrency
- Decorator
- 시바견
- 109. Convert Sorted List to Binary Search Tree
- 운영체제
Archives
- Today
- Total
Scribbling
[C++] Min Heap <int> 본문
https://leetcode.com/problems/meeting-rooms-ii/description/
class Solution {
public:
int minMeetingRooms(vector<vector<int>>& intervals) {
sort(intervals.begin(), intervals.end());
priority_queue<int, vector<int>, greater<int>> pq;
int ret = 0;
for (vector<int>& interval : intervals) {
int s = interval[0], e = interval[1];
while (!pq.empty() and pq.top() <= s) {
pq.pop();
}
pq.push(e);
ret = max(ret, int(pq.size()));
}
return ret;
}
};