Your question is Peak Capacity Intervals. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Faire's marketplace operations team represents each active capacity reservation as a time interval. Given all reservations, return the time intervals during which the number of concurrent reservations is at its maximum.
Treat intervals as half-open, [start, end): a reservation is active at start but not at end. If multiple peak intervals are directly adjacent, merge them into one interval.
Implement peak_capacity_intervals(intervals), where intervals is a list of two-element integer lists [start, end]. Return a list of two-element lists representing the maximal disjoint intervals [start, end] during which the concurrent reservation count equals the global maximum. Return [] when intervals is empty.
def peak_capacity_intervals(intervals):