← 返回 snowflake 的题目列表Meeting Rooms II
类型:qbank
Given an array of meeting time interval objects consisting of start and end times [[start1,end1],[start2,end2],...] (starti < endi), find the minimum number of meeting rooms required to schedule all meetings without any conflicts.
Meeting Rooms II
Given an array of meeting time interval objects consisting of start and end times [[start1,end1],[start2,end2],...] (starti < endi), find the minimum number of meeting rooms required to schedule all meetings without any conflicts.
SWE
interval
heap
sorting
medium
Frequency
Single report
Last asked
2026-02-06
Stage
phone-screen · onsite-coding
Meeting Rooms II
Problem Explanation
You are given a list of meeting time intervals. Each item in the list represents a single meeting with a start time and an end time (looks like [[start_1, end_1], [start_2, end_2], ...]).
Your goal is to find the minimum number of conference rooms needed to hold all these meetings. You must ensure that no two meetings occur in the same room at the same time.
Important Rule: If a meeting ends exactly at the same time another one starts (for example, one ends at 8 and the next starts at 8), this is not a conflict. You can use the same room for both.
Sample Scenarios
Scenario 1:
Input: intervals = [(0,40),(5,10),(15,20)]
Output: 2
Breakdown:
Room 1: Takes the meeting from 0 to 40.
Room 2: Takes the meeting from 5 to 10 and the meeting from 15 to 20.
Scenario 2:
Input: intervals = [(4,9)]
Output: 1
Input Limits
0 <= intervals.length <= 500 (The list can have up to 500 meetings).
0 <= intervals[i].start < intervals[i].end <= 1,000,000 (Time values are up to 1 million).