Java Easy DP
\n// For each cell, store number of consecutive 1\'s in each direction: up, down, left and right\nclass Cell {\n    int val, up, down, left, right;\n    Cell(in
```\n// For each cell, store number of consecutive 1\'s in each direction: up, down, left and right\nclass Cell {\n    int val, up, down, left, right;\n    Cell(int val) {\n        this.up = this.down = this.left = this.right = this.val = val;\n    }\n    int getPlusSize() {\n        return Math.min(up, Math.min(down, Math.min(left, right)));\n    }\n}\nclass Solution {\n    public int orderOfLargestPlusSign(int n, int[][] mines) {\n        Cell[][] mat = new Cell[n][n];\n        for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) mat[i][j] = new Cell(1);\n        for(int[] mine: mines) mat[mine[0]][mine[1]] = new Cell(0);\n        \n        for(int i = 0; i < n; i++) {\n            for(int j = 0; j < n; j++) {\n                if(mat[i][j].val == 1) {\n                    if(i > 0) mat[i][j].left += mat[i-1][j].left;\n                    if(j > 0) mat[i][j].up += mat[i][j-1].up;\n                }\n            }\n        }\n        \n        for(int i = n-1; i >= 0; i--) {\n            for(int j = n-1; j >= 0; j--) {\n                if(mat[i][j].val == 1) {\n                    if(i+1 < n) mat[i][j].right += mat[i+1][j].right;\n                    if(j+1 < n) mat[i][j].down += mat[i][j+1].down;\n                }\n            }\n        }\n        \n        int ans = 0;\n        for(int i = 0; i < n; i++) for(int j = 0; j < n; j++)\n            ans = Math.max(ans, mat[i][j].getPlusSize());\n        return ans;\n    }\n}\n```
[]