38. Meeting Rooms — Conflict Detection
Decide whether one person can attend every meeting from beginning to end without being in two meetings at the same time. The input order need not already be chronological.
A meeting ending exactly when another begins does not create a conflict. You are deciding feasibility for one attendee, rather than counting the number of rooms.
Example 1
Input
[[0,30],[5,10],[15,20]]
Output
false
Explanation: The first long meeting conflicts with the meeting starting at five.
Example 2
Input
[[7,10],[2,4],[4,7]]
Output
true
Explanation: Sorting gives a compatible chain; equal end/start boundaries do not overlap.
Constraints
0 <= meetings.length <= 105meetings[i].length == 2-231 <= start < end <= 231 - 1
Hints
Hint 1
After sorting by start, where must the first conflict appear?
Hint 2
What does a conflict-free prefix tell you about all its earlier end times?
Hint 3
Reject an adjacent strict overlap; otherwise extend the compatible chain.
Submissions
Your recent submissions for this problem.
Checking sign-in…
Discussion
Ask a question or share an approach. Posts are public; avoid personal information and mark solution spoilers clearly.
No discussion yet. Start the conversation with a question about this problem.
Checking sign-in…
Run your code to check the sample cases, or submit it to check the full validation suite.
An unsorted compatible chain
[[7,10],[2,4],[4,7]]
true