You are given an array of intervals intervals, where each interval is a pair [start, end] with start <= end.
Merge all overlapping intervals and return a new array of non-overlapping intervals that covers all the intervals in the input.
Two intervals [a,b] and [c,d] overlap if c <= b (assuming a <= c after sorting).
intervals: number[][]
number[][]
merged intervals
[[1,3],[2,6],[8,10],[15,18]]
[[1,6],[8,10],[15,18]]
1 <= intervals.length <= 10^5