You are given an integer `n`. There are `n` rooms numbered from `0` to `n - 1`. You are given a 2D integer array `meetings` where `meetings[i] = [start_i, end_i]` means that a meeting will be held during the **half-closed** time interval `[start_i, end_i)`. All the values of `start_i` are **unique**. Meetings are allocated to rooms in the following manner: 1. Each meeting will take place in the **unused** room with the **lowest** number. 2. If there are no available rooms, the meeting will be delayed until a room becomes free. The delayed meeting should have the **same** duration as the original meeting. 3. When a room becomes unused, meetings that have an earlier original **start** time should be given the room. Return the **number** of the room that held the most meetings. If there are multiple rooms, return the room with the **lowest** number.
Example 1
Input: n = 2, meetings = [[0,10],[1,5],[2,7],[3,4]]
Output: 0
Explanation: [0,10] takes room 0 and [1,5] takes room 1. [2,7] waits for room 1 and runs [5,10]. [3,4] waits until time 10, when both rooms free up, and takes the lower number, room 0. Each room hosts 2 meetings, and the tie goes to room 0.
Example 2
Input: n = 3, meetings = [[1,20],[2,10],[3,5],[4,9],[6,8]]
Output: 1
Explanation: [1,20], [2,10] and [3,5] take rooms 0, 1 and 2. [4,9] waits for room 2 and runs [5,10]. [6,8] waits until time 10, when rooms 1 and 2 free up, and takes room 1. Rooms 1 and 2 each host 2 meetings, and the tie goes to room 1.
Example 3
Input: n = 1, meetings = [[0,5],[5,10]]
Output: 0
Explanation: With a single room, [0,5] runs first and [5,10] starts right as it ends. Room 0 hosts both meetings.
Process meetings by start time. Keep a min-heap of free room numbers and a min-heap of busy rooms keyed by (end time, room). Free up rooms whose end <= now; assign the lowest free room, or if none, delay onto the room that frees earliest (breaking ties by lowest number).
Run checks all cases above. Submit evaluates all test cases.