Booking.com Interview Question

already described above, typical hackerrank challenge