OCTO Technology interview question

resolve this psuedo code with recursive way.