Example #1
0
def insert(intervals, newInterval):
    intervals.append(newInterval)
    intervals.sort(key=lambda x: x.start)
    return list(merge_intervals(intervals))
def insert(intervals, newInterval):
    intervals.append(newInterval)
    intervals.sort(key=lambda x:x.start)
    return list(merge_intervals(intervals))
Example #3
0
def merge(intervals):
    if not intervals:
        return []

    intervals.sort(key=lambda x:x.start)
    return list(merge_intervals(intervals))