eBay interview question

Medium Leet Code recursion question