Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

intervals =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Use a min-heap of end times for currently occupied rooms.

Approach

Sort by start. For each meeting:

  • If earliest-ending room ends <= start, reuse it (pop/replace).
  • Else allocate new room. Heap size is rooms needed.
Code
Loading...
Complexity
Time: O(n log n)
Space: O(n)
Solution
Updated: 2026-02-23

Idea

Use a min-heap of end times for currently occupied rooms.

Approach

Sort by start. For each meeting:

  • If earliest-ending room ends <= start, reuse it (pop/replace).
  • Else allocate new room. Heap size is rooms needed.
Code
Loading...
Complexity
Time: O(n log n)
Space: O(n)