C# DP solution
time: O(N^2)\n- space: O(N^2)\n\npublic class Solution {\n    public int OrderOfLargestPlusSign(int n, int[][] mines) {\n        \n        // build the grid\n  
- time: O(N^2)\n- space: O(N^2)\n```\npublic class Solution {\n    public int OrderOfLargestPlusSign(int n, int[][] mines) {\n        \n        // build the grid\n        int[,] grid = new int[n,n];\n        for(int i = 0; i < n; i++)\n        {\n            for(int j = 0; j < n; j++)\n            {\n                grid[i,j] = 1;\n            }\n        }\n        \n        foreach(var mine in mines)\n        {\n            grid[mine[0],mine[1]] = 0;\n        }\n        \n        // build the dp array. dp[i,j]: minimal length of the four arms starting from (i,j)\n        int[,] dp = new int[n,n];\n        for(int row = 0; row < n; row++)\n        {\n            // left -> right\n            int maxLength = 0;\n            for(int col = 0; col < n; col++)\n            {\n                maxLength = grid[row,col] == 0? 0 : maxLength + 1;\n                dp[row,col] = maxLength;\n            }\n            \n            // right -> left\n            maxLength = 0;\n            {\n                for(int col = n - 1; col >= 0; col--)\n                {\n                    maxLength = grid[row,col] == 0? 0 : maxLength + 1;\n                    dp[row,col] = Math.Min(dp[row,col], maxLength);\n                }\n            }\n        }\n        \n        for(int col = 0; col < n; col++)\n        {\n            // up -> down\n            int maxLength = 0;\n            for(int row = 0; row < n; row++)\n            {\n                maxLength = grid[row,col] == 0? 0 : maxLength + 1;\n                dp[row,col] = Math.Min(dp[row,col], maxLength);\n            }\n            \n            // down -> up\n            maxLength = 0;\n            for(int row = n - 1; row >= 0; row--)\n            {\n                maxLength = grid[row,col] == 0? 0 : maxLength + 1;\n                dp[row,col] = Math.Min(dp[row,col], maxLength);\n            }\n        }\n        \n        int res = 0;\n        for(int i = 0; i < n; i++)\n        {\n            for(int j = 0; j < n; j++)\n            {\n                res = Math.Max(res, dp[i,j]);\n            }\n        }\n        \n        return res;\n    }\n}\n```
[]