Your question is Merge Overlapping Trade 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.
At a trading firm like Jane Street, market activity is recorded as time intervals. Given a list of intervals representing active trading windows, merge all overlapping intervals and return the condensed list in ascending order.
Implement a function that takes intervals, a list of lists where each element is [start, end] and start <= end. Return a new list of merged intervals, where any overlapping or touching intervals are combined into a single interval.
def merge_trade_intervals(intervals):