Skip to content
LC-0252 Easy LeetCode

252. Meeting Rooms

Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 59% Topics: Array, Sorting
View full problem on LeetCode
Reference solution (spoiler · python)
# Time:  O(nlogn)
# Space: O(n)

class Solution(object):
    def canAttendMeetings(self, intervals):
        """
        :type intervals: List[List[int]]
        :rtype: bool
        """
        intervals.sort(key=lambda x: x[0])

        for i in xrange(1, len(intervals)):
            if intervals[i][0] < intervals[i-1][1]:
                return False
        return True

Solution from kamyu104/LeetCode-Solutions · MIT