Given an array of meeting time intervals where intervals[i] = [starti, endi], return the minimum number of conference rooms required. You must allocate rooms such that no two overlapping meetings share the same room.
Example 1
Input: intervals = [[0,30],[5,10],[15,20]]
Output: 2
Explanation: [0,30] needs its own room for the whole time. [5,10] and [15,20] happen one after the other, so they can share a second room. Two rooms are enough.
Example 2
Input: intervals = [[7,10],[2,4]]
Output: 1
Explanation: The meetings do not overlap, so one room is enough.
Example 3
Input: intervals = [[1,5],[2,3],[4,6],[5,7]]
Output: 2
Explanation: At most two meetings run at once: [1,5] and [2,3] around time 2, then [1,5] and [4,6] around time 4. [5,7] can take the room that [1,5] frees at time 5. So two rooms are enough.
Sort meetings by start time, then use a min-heap to track the earliest ending meeting. If the next meeting starts after the earliest ending one, reuse that room; otherwise allocate a new room.
Run checks all cases above. Submit evaluates all test cases.