How to print only one possible solution for rat in a maze?

I wanted to know what should be the code change so that only the first possible path is printed?
Thanks

hello @nik72619c

return boolean , if u found one path.

and then use that return value to judge whether u have to make another call or not.

if this does not make any sense to u . then share ur code with me using cb ide.
i will add the required changes

Hi Aman, I am referring to the same code in the video for rat in a maze problem. In that video we are also returning the boolean right ?

@nik72619c

yeah , that code will print only one path because of boolean (no need to make any furthur changes).

Could you share the recursion tree (in a simple compact form works) for this ?

pls refer the animation for the problem from here-> link

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.