Booking.com interview question

already described above, typical hackerrank challenge