Find the minimum room count with a proven heap algorithm, then analyze dynamic admissions and room capacities. Separate interchangeable-room overlap from fixed assignments and suitability constraints.
Find the Minimum Meeting Rooms and Discuss Dynamic Constraints
Company: eBay
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Given meeting intervals, return the minimum number of conference rooms needed so that overlapping meetings use different rooms.
### Constraints and Clarifications
For the baseline, use half-open intervals [start,end) with start<end, so a room is reusable at its previous meeting's end time. These endpoint conventions are explicit practice clarification. Empty input needs zero rooms; no numerical bounds are supplied. Follow-ups introduce a stream of new meetings and rooms with different capacities, which require additional policy choices beyond the baseline count.
### Part 1 — Static Meetings
Find the minimum room count for a fixed collection of intervals and explain why the greedy algorithm works.
#### What This Part Should Cover
Sort by start time and track room end times in a min-heap, or use an equivalent sweep line.
### Part 2 — Dynamic Arrivals
How would you check whether a new interval fits a fixed room limit when meetings can arrive in arbitrary order?
#### What This Part Should Cover
Clarify admission versus reassignment and discuss interval or segment-tree state rather than pretending start-time sorting is already available.
### Part 3 — Capacity Constraints
What changes when each room has a capacity and each meeting has an attendee count?
#### What This Part Should Cover
Separate temporal availability from suitability, define the assignment objective, and avoid claiming the homogeneous-room lower bound alone proves feasibility.
### What a Strong Answer Covers
A proven static solution with complexity and concrete, scoped designs for the two extensions. The baseline count is the deterministic coding contract; follow-up policies must be specified before implementation.
### Follow-up Questions
- Why is an available but undersized room not a valid reuse candidate?
- What guarantees are lost if previously assigned meetings cannot be moved?
Overview: Find the minimum room count with a proven heap algorithm, then analyze dynamic admissions and room capacities. Separate interchangeable-room overlap from fixed assignments and suitability constraints.
Given meeting intervals, return the minimum number of conference rooms needed so that overlapping meetings use different rooms.
Constraints and Clarifications
For the baseline, use half-open intervals [start,end) with start<end, so a room is reusable at its previous meeting's end time. These endpoint conventions are explicit practice clarification. Empty input needs zero rooms; no numerical bounds are supplied. Follow-ups introduce a stream of new meetings and rooms with different capacities, which require additional policy choices beyond the baseline count.
Part 1 — Static Meetings
Find the minimum room count for a fixed collection of intervals and explain why the greedy algorithm works.
What This Part Should Cover Guidance
Sort by start time and track room end times in a min-heap, or use an equivalent sweep line.
Part 2 — Dynamic Arrivals
How would you check whether a new interval fits a fixed room limit when meetings can arrive in arbitrary order?
What This Part Should Cover Guidance
Clarify admission versus reassignment and discuss interval or segment-tree state rather than pretending start-time sorting is already available.
Part 3 — Capacity Constraints
What changes when each room has a capacity and each meeting has an attendee count?
What This Part Should Cover Guidance
Separate temporal availability from suitability, define the assignment objective, and avoid claiming the homogeneous-room lower bound alone proves feasibility.
What a Strong Answer Covers Guidance
A proven static solution with complexity and concrete, scoped designs for the two extensions. The baseline count is the deterministic coding contract; follow-up policies must be specified before implementation.
Follow-up Questions Guidance
Why is an available but undersized room not a valid reuse candidate?
What guarantees are lost if previously assigned meetings cannot be moved?