Rat in maze problem

public class Main {
static int n;
public static void printsol(int sol[][]){
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
System.out.print(" “+sol[i][j] +” ");
System.out.println();

    }
}

public static boolean issafe(int maxe[][],int x,int y){
return(x>=0 && x<n && y>=0 && y<n && maxe[x][y]==1);
}
public static boolean solvemazeutil(int maze[][],int x,int y,int sol){
if(x==n-1 && y==n-1){
sol[x][y]=1;
return true;
}
if(issafe(maze,x,y)==true){
sol[x][y]=1;
if(solvemazeutil(maze,x+1,y,sol))
return true;
if(solvemazeutil(maze,x,y+1,sol))
return true;
sol[x][y]=0;
return false;}return false;}

public static boolean solveMaze(int maze[][]){
int sol[][]=new int[n][n];
if(solvemazeutil(maze,0,0,sol)==false){
return false;
}
printsol(sol);
return true;
}

public static void main(String args[]) {

    int maze[][] = { { 1, 0, 0, 0 }, 
                     { 1, 1, 0, 1 }, 
                     { 0, 1, 0, 0 }, 
                     { 1, 1, 1, 1 } }; 

    n = maze.length; 
solveMaze(maze); 
   
}

}
what is problem in my code

Hi Sweta! You’re asking a Rat in a maze doubt with content of Find the next greater element.
I’m not sure which question you have doubt in?

i am asking rat in maze

int[][] sol in your util function parameters

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.