Bank of America interview question

Recursive coin task