Compilation error is occuring

hey @Sadaf_khan0107 change input format
int n = sc.nextInt();
int m = sc.nextInt();
char[][] maze = new char[n][m];
for (int i = 0; i < n; i++) {
String str = sc.next();
for (int j = 0; j < m; j++) {
maze[i][j] = str.charAt(j);
}
}
should look like this
Read this line carefully A path is rightmost, If solution doesn’t exist, just print “-1”.
Basically you are printing all possible paths

@Monu-Singh-480654572341490
u mean to say i can only move down nd right in this case

@Sadaf_khan0107
yes ,

@Monu-Singh-480654572341490
output is not printing

your logic is Wrong .
We only needed two recursive calls.
and You are not doing backtrack
algo:-
If destination is reached print the solution matrix .
Else .
a) Mark current cell in solution matrix as 1.
b) Move forward in the horizontal direction and recursively check if this move leads to a solution.
c) If the move chosen in the above step doesn’t lead to a solution then move down and check if this move leads to a solution.
d) If none of the above solutions works then unmark this cell as 0 (BACKTRACK) and return false
If you are not able to write code, I will help

@Monu-Singh-480654572341490


wrong output again