Rat Chases its Cheese


not working for test case 0 and test case 1

Hello @bhattanurag426 think of the case when you have reached the last row and because there was no other option as all other were block.
and from the last row there is a way to the up through the second column.
basically think like that you have to move in four directions and you have to find the way then.
but you code is not able to do in that way.

OXOOOOX
OXOXOXX
OXOXOOX
OOOXOXX
XXOXOOO
this is how the rat will find its way:
1X1111X
1X1X1XX
1X1X1OX
111X1XX
XXOX111

https://ide.codingblocks.com/s/416471 sir i made these changes but now segmentation fault

@bhattanurag426 i have corrected your code:


Happy Learning!!

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.