Beyondsoft Group interview question

Basic recursion problem - was asked to dry-run it.