Concise python implementation


  • 1
    N

    This is my short python implementation based on the idea presented here.

    class Solution(object):
        def minMeetingRooms(self, intervals):
            stimes, etimes = sorted([i.start for i in intervals]), sorted([i.end for i in intervals])
            ei = 0
            for st in stimes:
                if st >= etimes[ei]:
                    ei += 1
            return len(intervals) - ei
    

Log in to reply
 

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