Booking.com Interview Question

A recursive problem solution