Booking.com interview question

Coding challenge with two easy two hard wuestions