can you tell me what is problem with my code
Rat is in a maze
hey @Dhruv-Miglani-2090236747707980, check this contraints: 1<=N,M<=1000. You have taken the size as 10 only.
still no output pleasse look into it
hey @Dhruv-Miglani-2090236747707980, I have made changes to your code and indicate them as comments, Check them here https://ide.codingblocks.com/s/110776
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.
Hi gaurav i had a doubt
//check the right cell before going
if (j + 1 <= n && maze[i][j + 1] != ‘X’) {
bool rightSuccess = solve_Rat_In_A_Maze(maze, soln, i, j + 1, m, n);
if (rightSuccess) {
return true;
}
}
//check the down colmn before going
if (i + 1 <= m && maze[i + 1][j] != 'X') {
bool downSuccess = solve_Rat_In_A_Maze(maze, soln, i + 1, j, m, n);
if (downSuccess) {
return true;
}
}
why we are check the right cell before going and down cell haven’t we done for the current cell above of the code.