LinkedIn Interview Question

Merge intervals the. Output results