Rat Chases its cheese

why is it failing test case 2.

Also, where is the mistake as it is not printing “NO PATH FOUND” in this case…

5 4
OXOO
OOOO
XOOO
XOOO
XXXX

@Karanveer your code is correct and only fails when maze[n-1][m-1]==X so check this case separately


dont forget to hit like and mark resolved if cleared :smiley:

It is still printing the wrong path, and then saying NO PATH FOUND…

@Karanveer are you saying about the code that i sent you?

@Karanveer sorry little mistake i checked it below the function but it should be checked above

5 4
OXOO
OOOO
XOOO
XOXX
XXXO

In this case it is printing nothing…

5 4 OXOO OOOO XOOO XOXX XXXO In this case it is printing nothing…

@Karanveer ok let me check

@Karanveer ok so just take a check var to store whether ans exist or not and check the two if above commented the changes

1 Like