bhaiya i tried many times but can’t understand why it is not passing 2 test cases.
give me hint regarding this
Rat chases its cheese
hello @ikshit9
this problem is bit differnet from rat in maze problem.
here rat can move in all four directions. so from (i,j) u need to make four calls.
also because movement is allowed in all four direction , it is possible that u reach visited state more than once which will cause loop and the program will run ininfitely. so u need to keep the track of visited cells.if u reach to visited cell again then simply retunr false.
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.