Barclays interview question

Solve algorithms using recursion