Want to break recursion

when function hit first time base case
after printing sol, i want to break recursion.

hello @officialharshit1996
use the boolean value that u r returning from base case.
if it is true then it indicates that u have reached the base case so simply return true otherwise execute next statements

in base case i have mentioned return true

@officialharshit1996
image

i m talking for this , if rightsucess is true then simply reutrn true otherwise execute next statements

i still not able to pass test cases

if u can modify the code that would be great.

@officialharshit1996
u were not considering -1 case
check now->

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.