Booking.com interview question

Coding Round: Trip Itenerary problem