Pregunta de entrevista de Amazon

Question on leetcode (merge intervals)