WillowTree interview question

Whiteboard coding - algorithm, recursion