Airbnb interview question

coding question using recursion