Java - O(n^2) time and space
\n\nclass Solution {\n    int[][] hori; int[][] verti; \n    public int orderOfLargestPlusSign(int n, int[][] mines) {\n        hori = new int[n][n]; \n        
```\n\nclass Solution {\n    int[][] hori; int[][] verti; \n    public int orderOfLargestPlusSign(int n, int[][] mines) {\n        hori = new int[n][n]; \n        verti = new int[n][n]; \n        int[][] grid = new int[n][n]; \n        for (int i = 0; i < n; i++){Arrays.fill(grid[i], 1); }\n        for (int i = 0; i < mines.length; i++){\n            grid[mines[i][0]][mines[i][1]] = 0; \n        }\n        for (int i = 0; i < n; i++){\n            hori[i][0] = grid[i][0]; \n        }\n        \n        for (int i = 0; i < n; i++){\n            verti[0][i] = grid[0][i]; \n        }\n        for (int i = 0; i < n; i++){\n            for (int j = 1; j < n; j++){\n               if (grid[i][j] == 1)\n                hori[i][j] = hori[i][j- 1] + grid[i][j]; \n                 else hori[i][j] = 0; \n\n             }\n                   }\n        \n        for (int j = 0; j < n; j++){\n            for (int i = 1; i < n; i++){\n                if (grid[i][j] == 1)\n                verti[i][j] = verti[i - 1][j] + grid[i][j];\n                else verti[i][j] = 0; \n             }\n        }\n        \n        for (int k = n ; k > 0; k--){\n            boolean holdstrue = false;\n            for (int i = 0; i < n; i++){\n                for (int j = 0; j < n; j++){\n                    if (hori[i][j] >= 2*k - 1){\n                        int center = j - (k) + 1; \n                        if (i + k - 1 < n && center >= 0 && verti[i + k - 1][center] >= 2*k - 1 && verti[i][center] >= k - 1){\n                            holdstrue = true; \n                            System.out.println(i + " " + j); \n                            System.out.println(i + " " + center);\n                            return k; \n                            \n                        }\n                    }\n                }\n                if (holdstrue) break;\n            }\n            if (holdstrue) return k; \n        }\n        if (mines.length < n*n)return 1; \n        return 0; \n    }\n}\n```
[]