Merge Intervals

Create a function that accepts a list of intervals as input and return a list of intervals where the overlapping intervals are merged into one.

Example

Input: [[1, 3], [2, 6], [8, 10], [15, 18]]
Output: [[1, 6], [8, 10], [15, 18]]

Source

LeetCode