Recursion Rar in a Maze

How 1 and 0 are printed ??

Please dry run for 1 test case?

@ashwani225 when we are calling any function for right or down we assign sol[i][j]=1 before calling recursion, so it will run similarly till we are getting path in the grid if any path becomes invalid we come back from that path and put our sol[i][j]=0 and check for any other path.

its very simple logic Take a pen and paper and try this code for sample case you will understand how it is working

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.