Airbnb Interview Question

coding question using recursion