Meeting Rooms II
mediumFind minimum number of conference rooms needed
Meeting Rooms II
Key Insight
Sort starts and ends; sweep with two pointers to count how many meetings overlap at any time.
Step 1Sort Start and End Arrays
starts sortedends sorted
[0,5,15]
0[10,10,20]
1Start list: [0, 5, 15], end list: [10, 10, 20] after sorting.
1 / 4
Learn the Pattern
SortingUse sorting as a preprocessing step to simplify problems, or apply partition logic for in-place rearrangement. Many interview problems become trivial once the array is sorted.
HeapUse a heap (priority queue) when you repeatedly need the minimum or maximum of a changing set while also inserting and deleting values efficiently.