Python Simple O(n logn) Solution


  • 1
    G
    def canAttendMeetings(intervals):
        intervals = sorted(intervals, key=lambda x:x.start)
        for i in range(1,len(intervals)):
            if intervals[i].start < intervals[i-1].end:
                return False
        return True

Log in to reply
 

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