Intervals Without Overlaps
You are given a two dimensional array containing arrays of intervals. Return a two dimensional array containing arrays of intervals with all overlaps removed.
Assume that arguments will always contain at least one set of overlapping intervals.
Requirements
- Must return a two dimensional array containing on or more arrays of intervals.
Example #1
solve([[1,3], [2, 4], [4, 15]])
> [[1, 15]]
All interval arrays overlap, so we merge them into one and return \[\[1, 15\]\]
Example #2
solve([[1,3], [4, 10], [7, 8]])
> [[1, 3], [4,8]]
Intervals 4,10 overlap with 7,8 so we merge them to \[4,8] and then return \[\[1, 3], [4,8\]\]