Regarding a hackerblock problem

sir can we do this question without vector if yes can you just send the code of it
https://hack.codingblocks.com/app/dcb/2129

this is the question based on recursion

you can either use vector or array your choice