Question d’entretien chez Booking.com

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