Greedy / Heap•Pattern: Greedy + Heap•Medium

Meeting rooms II — minimum rooms needed

Problem Intuition & Objective

Find the minimum number of conference rooms to hold all meetings.

Time ComplexityO(n log n)
Optimal
Space ComplexityO(n)
Memory Bounds
Optimal Algorithmic Approach

Sort + min-heap of room end times.

Core Invariants & Edge Cases

  • Sort meetings by start time
  • Min-heap of end times: if next start >= min end, reuse room (pop and push new end)
  • Otherwise allocate a new room (push new end); heap size = rooms used
Previous ProblemGas station — can you complete the circuit?Next Problem Candy distribution — minimum candies

System Design & Architecture Roadmap

Coding interviews are only 50% of the bar. Master High-Level Design, distributed systems, and Object-Oriented LLD.