Collabera Digital interview question

Asked to solve recursion problem