Pergunta de entrevista da empresa Booking.com

there was a task to merge intervals, but the input was a large and confusing array of data