Practice

Meeting Rooms II

Module 14 · Sorting

Problem

Given meeting time intervals [start, end], return the minimum number of conference rooms required so that no two meetings using the same room overlap.

Examples

Example 1

Input[[0,30],[5,10],[15,20]]Output2

Explanation. 0-30 overlaps both others, but they don't overlap each other

Example 2

Input[[7,10],[2,4]]Output1

Constraints

1 ≤ n ≤ 10⁴.

Attempt it first

This is NOT Merge Intervals — it doesn't ask to merge overlapping ranges, it asks how many are simultaneously in progress at the busiest moment. Separate the starts and ends and think about what a "room in use" count does as time moves forward.