Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int minMeetingRooms(vector<vector<int>>& intervals) {
- int res = 0;
- sort(intervals.begin(), intervals.end());
- priority_queue<int, vector<int>, greater<int>> pq;
- for (auto& interval : intervals) {
- while (!pq.empty()) {
- if (pq.top() > interval[0]) break;
- pq.pop();
- }
- pq.push(interval[1]);
- res = max(res, int(pq.size()));
- }
- return res;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement