Loading
Loading
A consultant has been sent a list of meeting requests. Each request is a row [start, end] in minutes; a meeting occupies the time from start up to, but not including, end. The consultant can only be in one meeting at a time.
Return true if all requested meetings can be attended. A meeting that starts at the exact minute another ends does not clash with it.
meetings = [[1, 4], [6, 8], [3, 5]][1,4] [3,5] [6,8]sorted by start[1,4] vs [3,5]3 < 4 — the second starts before the first endsfalseSign in to keep a note here. It is free, and nobody else can see it.
Sign inExample 1
| 0 | 9 | 10 |
|---|---|---|
| 1 | 13 | 15 |
| 2 | 10 | 12 |
Sorted: [9,10], [10,12], [13,15]. The first two only share a boundary.
Example 2
Sign in to open hints.
Struggling is where the learning happens. Open this once you have genuinely tried, or once the hints have run out.
O(n log n) time · O(n) space
Input. Run your code to watch it work on this input, one line at a time.
| 0 | 9 | 10 |
|---|---|---|
| 1 | 13 | 15 |
| 2 | 10 | 12 |
Running code is turned off on this deployment. You can still read the problem, write code, use hints and the visualizer.
Tab moves focus out of the editor. Press Ctrl+M to let Tab indent instead.
No results yet
Run your code against the sample tests, or submit to run the full suite.
| 0 | 1 | 4 |
|---|
| 1 | 6 | 8 |
|---|
| 2 | 3 | 5 |
|---|
[3,5] starts before [1,4] ends.