here question is solved by taking only two allowed direction i.e rat can move only rightward and downward direction. when i am try to solve where rat can move in all direction getting problem , my ouput in not generating.
my code is as follow:
here question is solved by taking only two allowed direction i.e rat can move only rightward and downward direction. when i am try to solve where rat can move in all direction getting problem , my ouput in not generating.
my code is as follow:
you have missed one condition
if(sol[i][j]==1) return false;
this is necessary otherwise your code in a infinite cycle
i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course