Qualtrics Interview Question

They asked me to solve a problem using recursion