I wanted to know what should be the code change so that only the first possible path is printed?
Thanks
How to print only one possible solution for rat in a maze?
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 ?
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 ?
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.