Rachit Jain Interview Question

Link : https://www.youtube.com/watch?v=cDHdlG51Ums
In this video at 3:20 min , he talks about a graph question related to gold mine in a grid . I tried to solve it using bfs in 3-D but I am not getting any ans. It is always printing zero .Please have a look at this because I have not been able to debug it since two weeks. I have commented the code for better clarity.
Link to ide : https://ide.codingblocks.com/s/98249
Also , do let me know if there is a better approach .

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.