158: Merge intervals

Given a collection of intervals, merge overlapping intervals

 

Example 1

Input:  [[1, 3], [2, 5]]

Output: [[1, 5]]

Example 2

Input:  [[1, 3], [2, 5], [5, 7], [8, 10]]

Output: [[1, 7], [8, 10]]
Difficulty:Medium
Topic:ArraySorting
Problem #:158