python solution runtime 78ms


  • 0
    L
    def minMeetingRooms(self, intervals):
            rooms = 0
            meetings = []
            for i in sorted(intervals, key = lambda interval: interval.start):
                found = False
                for meeting in meetings:
                    if i.start >= meeting.end:
                        meeting.end = i.end
                        found = True
                        break
                if not found:
                    meetings.append(i)
                    rooms += 1
            return rooms
    

Log in to reply
 

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