72. Meeting Rooms

Given an array of meeting time intervals where intervals[i] = [starti, endi].

Determine if a person could attend all meetings.

Example 1:

Input: intervals = [[1, 5], [3, 8], [6, 10], [12, 15]]

Output: false

Explanation: Overlapping meetings exist at [1,5] and [3,8], making it impossible to attend all.

Example 2:

Input: intervals = [[2, 6], [7, 9], [10, 14], [15, 18]]

Output: true

Explanation: No overlapping meetings, so all can be attended.

Now Your Turn!

Pick the correct output for the given input

Input: intervals = [[0, 4], [4, 9], [10, 13], [14, 17]]

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 0 <= intervals.length <= 104
  • intervals[i].length == 2
  • 0 <= starti < endi <= 106

Hints

Frequently Occurring Doubts

Interview Follow-up Questions

Fun Facts

0
class Solution {
public:
bool canAttendMeetings(vector<vector<int>>& intervals) {
// Your code goes here
}
};
Test Case

Input:

Intervals