Given a list of meetings, where a meeting has a start and an end time, determine the minimum number of rooms required to schedule all the meetings without any conflicts. A person can also attend a meeting if its starting time is the same as the previous meeting’s ending time.
Input: meetings = [[5, 10], [2, 3]]
Output: 1
Input: meetings = [[1, 3], [5, 7], [4, 6], [7, 9], [9, 10]]
Output: 2
Constraints:
1 <= meetings.length <= 10,0000 <= start <= 10,0000 <= end <= 10,000
这道题要求计算同时进行的会议最多有多少场,也就是安排所有会议所需的最少会议室数量。核心做法通常是先按开始时间排序,再用最小堆维护当前每个会议室里最早结束的会议;如果新会议的开始时间不早于堆顶结束时间,就可以复用该会议室,否则就需要新增一个会议室。由于题目明确允许“开始时间等于上一个会议结束时间”时继续安排,所以判断条件应使用“<”而不是“<=”。该题本质上是区间重叠统计,常见于 Microsoft VO / 面试题解析中,重点考察排序、优先队列以及对边界条件的处理。