Getting TLE in one test case

https://ide.codingblocks.com/s/62158
rat in a maze problem
getting tle in one test case. how to optimise it??

hey vishesh, you have not kept a visited array where you change value to 1 when going to that box
https://ide.codingblocks.com/s/56059