Given a list of intervals `[start, end]`, merge all overlapping intervals and return the minimal set of non-overlapping intervals that covers the same span.
This is exactly the logic behind merging overlapping peaks or genomic features — formalized.
Input: [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Note: [1,3] and [2,6] overlap and merge into [1,6].
// hit Run to execute the sample tests
// Interactive editor preview. Live code execution arrives with your early-access cohort.