Pregunta de entrevista de Booking.com

Coding challenge with two easy two hard wuestions