Amazon Interview Question

Question on leetcode (merge intervals)