Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Definition for an interval.
- # class Interval:
- # def __init__(self, s=0, e=0):
- # self.start = s
- # self.end = e
- class Solution:
- def minMeetingRooms(self, intervals: List[Interval]) -> int:
- import heapq
- heap = []
- max_rooms = 0
- intervals.sort(key=lambda x: x.start)
- for ent in intervals:
- heapq.heappush(heap, ent.end)
- while heap and heap[0] <= ent.start:
- heapq.heappop(heap)
- max_rooms = max(len(heap),max_rooms)
- return max_rooms
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement