Answer: Stripe OA Question 2024 July | Intervals & Heap | on-campus

Answer · Posted Jun 2026

Solution: Meeting Rooms II — Min Heap of End Times Approach We use a Min Heap that tracks the end times of all currently ongoing meetings. The heap tells us when the earliest-ending meeting finishes. Sort meetings by their start time. For each meeting, check if the earliest-ending ongoing meeting (top of heap) has finished before the current meeting starts. If yes: reuse that room (replace its end time in the heap). If no: allocate a new room (add end ...

The full answer & interview discussion are available to premium members.

Log in Create a free account