Practice/Meta/Leetcode 252. Meeting Rooms
CodingMust
You are building a calendar application that needs to validate whether a person can attend all their scheduled meetings. Given an array of meeting time intervals where each interval is represented as [start, end], determine if a person could attend all meetings without any scheduling conflicts.
Each interval represents a meeting that starts at time start and ends at time end. A person cannot attend two meetings if they overlap in time. Note that if one meeting ends exactly when another begins (e.g., [5, 8] and [8, 10]), the person can attend both meetings.
true if the person can attend all meetings (no overlaps exist)false if any two meetings have overlapping time slots0 <= intervals.length <= 10^4intervals[i].length == 20 <= start_i < end_i <= 10^6Example 1:
Input: intervals = [[0, 30], [5, 10], [15, 20]] Output: false Explanation: The meeting from 0 to 30 overlaps with the meeting from 5 to 10, and also overlaps with the meeting from 15 to 20. Therefore, it's impossible to attend all meetings.
Example 2:
Input: intervals = [[7, 10], [2, 4]] Output: true Explanation: The meeting from 2 to 4 ends before the meeting from 7 to 10 starts, so there are no conflicts.
Example 3:
Input: intervals = [[1, 5], [5, 8], [8, 10]] Output: true Explanation: Each meeting ends exactly when the next one starts, which means there are no overlaps and all meetings can be attended.