Run Maze backtracking condition

backtracking will happen only when left success and right success both is false and then we should have to make soln[i][j]=0

According to me code should be like

bool leftSuccess=ratInMaze(maze,soln,i,j+1,m,n);
bool rightSuccess=ratInMaze(maze,soln,i+1,j,m,n);
if(leftSuccess or rightSuccess)
{
return true;
}
else{
soln[i][j]=0;
return false;
}

@mohitmcanitt yeah your logic seems fine, where are you getting problem in 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.