Booking.com interview question

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