my code got accepted but i had one doubt that
//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 need to check before going right or down in the video sir did not checked before going right or down