Simple to Understand Java solution
\nclass Solution {\n    \n    /**\n    \n      1. Find the start , box and target cordinate .\n      \n      2. Then using Start Cordinate start BFS . Create No
```\nclass Solution {\n    \n    /**\n    \n      1. Find the start , box and target cordinate .\n      \n      2. Then using Start Cordinate start BFS . Create Normal Visted set \n      \n      3. There will be  3 Possibilities :\n          \n           3.1 You find the Target , return whateevr No of Moves you have done till now .\n           3.2 You find the Box , increase the Moves by 1, distance + moves +1  .\n           3.2 You dont find Box , so move On without increasing Moves \n           \n           \n   NOTE : Use PriotityQueue to sort Next value by Distance to get MIN diustnace         \n    \n    **/\n    \n    \n    \n    private static final int [][] DIRS = {{1,0},{-1,0},{0,1},{0,-1}};\n    \n    public int minPushBox(char[][] grid) {\n        \n        // STEP-1 Find the start , Box and Target Cordinate \n        \n        int start [] = new int[2];\n        int box [] = new int[2];\n        int target[] = new int[2];\n        \n        int rows = grid.length;\n        int cols = grid[0].length;\n        boolean startFound = false; \n        boolean boxFound = false;\n        boolean targetFound = false;\n        boolean found =false;\n        \n        for( int row =0; row < rows ; row++){\n            for( int col =0; col< cols ; col++){\n                 char curValue = grid[row][col];\n                 switch(curValue){\n                     case \'S\':\n                       startFound=true;\n                        start[0] = row;\n                        start[1] = col; \n                      break;\n                     case \'B\' :\n                        boxFound = true;\n                        box[0] = row;\n                        box[1] = col;  \n                       break;\n                     case \'T\':\n                        targetFound = true; \n                        target[0] = row;\n                        target[1] = col;\n                        break;\n                 }\n                if(startFound && boxFound && targetFound){\n                    found = true;\n                    break;\n                }\n            }\n            if( found){\n                break;\n            }\n        }\n        \n       // STEP-2 STart BFS starting from start Cordinate\n        PriorityQueue<int[]> pq = new PriorityQueue<>((pq1,pq2)->new Integer(pq1[0]).compareTo(pq2[0]));\n        pq.offer(new int[]{dist(box[0],box[1], target[0],target[1]) + 0,\n                           0 ,\n                          start[0],\n                          start[1], \n                          box[0],\n                          box[1]});\n        \n        Set<String> visited = new HashSet<>();\n        while(!pq.isEmpty()){\n            int size = pq.size();\n            for( int i=0; i < size ; i++){\n                int [] node = pq.poll();\n                int dist = node[0];\n                int moves = node[1];\n                int row = node[2];\n                int col = node[3];\n                int bxX = node[4];\n                int bxY = node[5];\n                \n                // if box equals to target return \n                if(bxX == target[0] && bxY== target[1]){\n                    return moves;\n                }\n                String key = row + "-" + col +"-"+ bxX +"-"+ bxY;\n                if(visited.contains(key)){\n                    continue;\n                }\n                visited.add(key);\n                // EXplore \n                for(int dir []: DIRS){\n                    int nRow = row + dir[0];\n                    int nCol = col + dir[1];\n                    if(!isValid(nRow,nCol, rows, cols, grid)){\n                        continue;\n                    }\n                    // if its equal to Box \n                    if(bxX == nRow &&  bxY == nCol) {\n                        int nBxX = nRow + dir[0];\n                        int nBxY = nCol + dir[1];\n                        if(!isValid(nBxX,nBxY, rows, cols, grid)){\n                            continue;\n                        }\n                      pq.offer( new int[]{dist(nBxX,nBxY,target[0],target[1]) + moves + 1 , moves +1 , nRow,nCol,nBxX,nBxY} );\n                    }else {\n                        // If the new cordinate not equal to Box \n                        pq.offer( new int[]{dist,moves,nRow,nCol,bxX, bxY} );\n                    }\n                }\n            }\n        }\n        return -1;\n        \n    }\n    \n    private boolean isValid(int row , int col , int rows , int cols, char grid[][]){\n        if(row < 0 || row > rows-1 || col < 0 || col > cols-1 || grid [row][col] == \'#\'){\n            return false;\n        }\n        return true;\n    }\n    \n    private int dist(int x, int y, int tx, int ty){\n        return Math.abs(x-tx)+Math.abs(y-ty);\n    }\n}\n```
['Java']