Doubt regarding rat in a maze problem

What if there are multiple solutions for a given test case . Then which output should we need to print .Can we print any possible output ?

hi @Lalit2142
all the solutions are generated with a particular approach so you will have to use that approach only otherwise you will get WR verdict.

it a recursive approach
If destination is reached print the solution matrix .
Else .
a) Mark current cell in solution matrix as 1.
b) Move forward in the horizontal direction and recursively check if this move leads to a solution.
c) If the move chosen in the above step doesn’t lead to a solution then move down and check if this move leads to a solution.
d) If none of the above solutions works then unmark this cell as 0 (BACKTRACK) and return false

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.