Back to Practice Dashboard
Top 150 InterviewEasy
Meeting Rooms
Learn how to solve the 'Meeting Rooms' problem. This detailed resource details brute force and optimized approaches.
Problem Statement
Easy
Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], determine if a person could attend all meetings.
Write a function canAttendMeetings(intervals: List[List[int]]) -> bool.
Constraints
- •0 <= len(intervals) <= 10^4
- •intervals[i].length == 2
- •0 <= starti < endi <= 10^6
Examples
Example 1
Input
intervals = [[0,30],[5,10],[15,20]]
Output
False
Explanation
Overlap exists between meetings.
Example 2
Input
intervals = [[5,8],[9,15]]
Output
True
Explanation
No overlapping meetings.
Need a Hint?
Analyze the input constraints. Try sorting first (O(n log n)) or using a hash map/set to track seen elements in O(n) time.
Edge Cases to Watch
- Empty list or null input variables
- Single item lists/arrays
- Extremely large input bounds causing integer or stack overflow
Ready to Solve?
Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.