https://leetcode.com/problems/meeting-rooms-ii/
class Solution {
public:
bool cmp(const Interval &a, const Interval &b) {
return a.start < b.start;
}
int minMeetingRooms(vector<Interval>& intervals) {
sort(intervals.begin(), intervals.end(), cmp);
priority_queue<int, vector<int>, greater<int>> q;
for (auto a : intervals) {
if (!q.empty() && q.top() <= a.start) q.pop();
q.push(a.end);
}
return q.size();
}
};