Upwind Interview Question

merge intervals. implement a solution.