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))
def merge(intervals): if not intervals: return [] intervals.sort(key=lambda x:x.start) return list(merge_intervals(intervals))