Object-Oriented Programming · Microsoft · Medium
1. Minimum Number of Rooms Approach 1: Sweep Line with Sorted Events Think of each interval as two independent events: a meeting starts, so we need one more room, and a meeting ends, so we can release one room. If we place all events on a timeline and walk from left to right, the number of rooms in use is just a running balance. Create an event (time, delta) for every interval: (start, +1) and (end, -1). Sort these events by time. When two events have the same time, process…
Checking your access…