JAVA SOLUTION USING DFS
The idea is very similar to doing a DFS only a slight variation that the distace keeps on increasing if a certain condition is satisfied. Once left, right, top,
The idea is very similar to doing a DFS only a slight variation that the distace keeps on increasing if a certain condition is satisfied. Once left, right, top, and bottom are met then we have to increase the distance by 1 and see if it satisfies the plus sign. If the condition is not met we simply break from the loop ans maximise our answer. Refer to the code for implementation. Do upvote id it was helpful!!!\n```\nclass Solution {\n    public int orderOfLargestPlusSign(int n, int[][] mines) {\n        int[][] arr = new int[n][n];\n        for(int i = 0 ; i < n ; i++){\n            for(int j = 0 ; j < n ; j++){\n                arr[i][j] = 1;\n            }\n        }\n        for(int[] i : mines){\n            int x = i[0];\n            int y = i[1];\n            arr[x][y] = 0;\n        }\n        // for(int i = 0 ; i < n ; i++){\n        //     for(int  j = 0 ; j < n ; j++){\n        //         System.out.print(arr[i][j] +" ");\n        //     }\n        //     System.out.println();\n        // }\n        int ans = 0;\n        for(int i = 0 ; i < n ; i++){\n            for(int j = 0 ; j < n ; j++){\n                if(arr[i][j] == 1)\n                {\n                   int order = 1;\n                    while(true){\n                       // System.out.println(order);\n                        if(!isValid(i - order , j , n , arr))\n                            break;\n                        if(!isValid(i + order , j , n , arr))\n                            break;\n                        if(!isValid(i , j - order , n , arr))\n                            break;\n                        if(!isValid(i , j + order , n , arr))\n                            break;\n                         \n                        order++;\n                        \n                    }\n                    ans = Math.max(ans , order);\n                }   \n            }\n        }\n        return ans;\n    }\n    public boolean isValid(int i  , int j , int n , int[][] arr){\n        if(i < 0 || j < 0 || i > n - 1 || j > n - 1)\n            return false;\n        if(arr[i][j] != 1)\n            return false;\n        return true;\n    }\n}\n```
['Depth-First Search', 'Java']