Domanda di colloquio di Booking.com

Given a array data structure, merge the array based on common keys AKA merge intervals