Booking.com Interview Question

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