Whats wrong here

Please just give me thoughts where i am wrong here…
I will try to code by myself…
First two test case is showing wrong answer,

try using bfs in this question as it is a standard question

Don’t have idea about BFS…
Could it be solved using this logic… without showing tle

basically try recursing in all directions and create a trace of the path executed until cheese reached

What’s wrong in the logic…

It is not showing any output… https://ide.codingblocks.com/s/307046