Google Interview Question

Problem related to Recursive function