Question d’entretien chez Booking.com

Two programming problems, probably around easy-medium on hackerrank. O notation and reasoning for the solutions you give.