Desquared interview question

Merge Intervals leetcode problem 56