Given a list of closed intervals [start, end], merge every pair that overlaps or touches and return the disjoint intervals sorted by start value.
Input / output
intervals: [integer, integer][]Examples
[[1,3],[2,6],[8,10],[15,18]] returns [[1,6],[8,10],[15,18]].[[1,4],[4,5]] returns [[1,5]] because the endpoints touch.Constraints
1 <= intervals.length <= 10,000-100,000 <= start <= end <= 100,000Follow-up If intervals arrived one at a time in sorted order, how would you merge them without storing the entire input?