Cognizant Interview Question

recursion using the python and r