ola ola
\nclass Solution {\n    public int nearestExit(char[][] maze, int[] e) {\n        int dx[]={1,-1,0,0};\n        int dy[]={0,0,-1,1};\n        if(maze[0].length=
```\nclass Solution {\n    public int nearestExit(char[][] maze, int[] e) {\n        int dx[]={1,-1,0,0};\n        int dy[]={0,0,-1,1};\n        if(maze[0].length==1&&maze.length==1||maze[e[0]][e[1]]==\'+\')return -1;\n        Queue<int[]>p=new LinkedList<>();\n        int a[]={e[0],e[1],0};\n        p.add(a);\n        maze[e[0]][e[1]]=\'+\';\n        \n        while(!p.isEmpty()){\n\n            int b[]=p.poll();\n                for(int k=0;k<4;k++){\n                    int x=b[0]+dx[k];\n                    int y=b[1]+dy[k];\n                    if(x<0||y<0||x>=maze.length||y>=maze[0].length||maze[x][y]==\'+\')continue;\n                  else  if(x==0||y==0||x==maze.length-1||y==maze[0].length-1&&maze[x][y]==\'.\'){System.out.println(x+" "+y+"ans");\n                      return b[2]+1;}\n                    System.out.println(x+" "+y+" "+ maze[x][y]);\n                int z[]={x,y,b[2]+1};\n                    p.add(z);\n                    maze[x][y]=\'+\';\n                \n            }\n            \n       \n        }\n             return -1;\n    }\n}\n```
[]