Logic of code applied

pls can any1 explain me the logic of the code why recursion is applied previously?

what do you want to ask
can you explain your question

recursive call is done earlier and then the value is stored in a string variable res .My qstn is why is it done there and not after replacing pi with 3.14 in the present index and then calling recursively the next half of the string

as you can see
to make ans for current idx
we need the string process by recursion
so we have to do our work after recursion

pls can you repeat I didn’t get ur words

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

hello @Senjuti256
u have reopend the doubt , let me know if u need any help

yes I did not understand the soln

this is also correct u can first replace pi and then u can solve for remaining string, both approaches will give correct result

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.