Rat chases its cheese


Why my code fails some test cases.
Is there any requirement of up and left movement. If yes how(example)

hi @ritikbunty2511_729d0258992e0982,
rat can move in 4 dir and check if the sol of new cell is 0 or not if 0 then only it can go else it cant