Amazon Interview Question

Questions similar to merge intervals.