Amazon interview question

Recursion Q