Out of 6,2 test cases failed
one is shown wrong answer and other shows TLE, plz,resolve
my code is
Rat in a maze, some test cases not run
Here, you need to maintain a visited array, and check
if(visited[i][j])
{
return false;
}
and also everytime you go to right or down, plz check as per the conditon :
if(j+1<=M && !visited[i][j+1])
{
bool rightSuccess=ratmaze(maze,i,j+1,N,M);
if(rightSuccess==true)
{
return true;
}
}
@yuktimutreja01 you want to say that, i should print only one solution(only one possible path) not all the path ??
Yes, in your current code, you are printing 3 paths for sample case, but actually there is only 1 path in the output, thts why you need to use the condition I mentioned so.