Upwind interview question

merge intervals. implement a solution.