Bloomberg Interview Question

OA (Hackerrank) Question: Recursion Questions