My Test Cases are not passing, please help

I have coded it, but unable to figure out where is it failing?

Please help, I am eagerly waiting for a solution.

@Shubham-Singh-3182890108418568,
Can you please share your code?

import java.util.*; public class Main { public static void main(String[]args) { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int M=sc.nextInt(); char arr[][]=new char[N][M]; for(int i=0;i<N;i++) { for(int j=0;j<M;j++) { arr[i][j]=sc.next().charAt(0); } } boolean flag[]= {false}; int ans[][]=new int[N][M]; funCall(arr,ans,N-1,M-1,0,0,flag); if(flag[0]==false) { System.out.println("-1"); } sc.close(); } public static void funCall(char arr[][],int ans[][],int N,int M,int i,int j,boolean flag[]) { if(arr[i][j]==‘X’) { return; } ans[i][j]=1; if(i==N && j==M) { for(int k=0;k<=N;k++) { for(int l=0;l<=M;l++) { System.out.print(ans[k][l]+" "); } System.out.println(); } flag[0]=true; return; } if(i<=N && j+1<=M && flag[0]==false) { funCall(arr,ans,N,M,i,j+1,flag); } if(i+1<=N && j<=M && flag[0]==false) { funCall(arr,ans,N,M,i+1,j,flag); } if(i<=N && j<=M && flag[0]==false) { ans[i][j]=0; } return; } }

https://justpaste.it/5pj2h

Here is the link to the code. Please help.

Please help in this question. I don’t know why my test cases are not passing.

@Shubham-Singh-3182890108418568,
https://ide.codingblocks.com/s/166412 Here is the corrected code.
Mistake: You can’t take char input in JAVA. You need to input a string and assign individual chars to every position in array

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.