Rat in a maze: Two testcases showing wrong answer
Try to submit now, I have made few changes,
Still getting one testcase wrong.
Maintain a visited array, as int visited[1001][1001]
and then check,
visited[i][j]=1;
if(j+1<=M && !visited[i][j+1])
{
bool rightSuccess=ratmaze(maze,i,j+1,N,M);
if(rightSuccess==true)
{
return true;
}
}
Repeat this for down also, since in the problem, it is given that you have to print the rightmost path only,