Rat chases cheese

same as rat in a maze…
except i have to add all 4 directions ?

what else i m missing ?

Hey @hg11110000
You are stuck in infinite loop ,just dry run on your sample,you also have to mantain a visited array so that u dont keep visiting the visited nodes.