In a Meta scheduling pipeline, you are given a list of time ranges representing busy windows for a service or model job. Merge all overlapping time ranges and return the minimal set of non-overlapping ranges covering the same time.
Implement a function that takes intervals, a list of intervals where each interval is a list [start, end] with start <= end, and returns a new list of merged intervals sorted by start time.
Two intervals overlap if the next interval's start is less than or equal to the current merged interval's end. In that case, they should be combined into [min_start, max_end].
def merge_intervals(intervals):
You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.