This problem was asked by Microsoft.
You are given an array of intervals - that is, an array of tuples (start, end). The array may not be sorted, and could contain overlapping intervals. Return another array where the overlapping intervals are merged.
Input: [(1, 3), (5, 8) , (4, 10), (20, 25)]
Output: [(1, 3), (4, 10), (20, 25)]
Explanation: (5, 8) and (4, 10) can be merged into (4, 10)