Recursion duplicate foramting

run time error :when i am running the code with for loop its working fine but when i do it with recursion it is giving error

hi shubham
there was a return statement missing in your code. i have pointed out where it was missing

I could not find the return statement about which you are saying.

i have added comment in one line. please check over there

when submitting this code its giving 2 test cases failed

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.