Concise Pythonic Solution

  • 0
    class Solution(object):
        def minMeetingRooms(self, intervals):
            :type intervals: List[Interval]
            :rtype: int
            events = list()
            for eve in intervals:
                events.append((eve.start, 1))
                events.append((eve.end, -1))
            events = sorted(events)
            Q = 0
            maxQ = 0
            for t, inc in events:
                Q += inc
                maxQ = max(Q, maxQ)
            return maxQ

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.