C++ solution dp
\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int N, vector<vector<int>>& mines) {\n        vector<vector<int>> a(N, vector<int> (N, 1));\n       
```\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int N, vector<vector<int>>& mines) {\n        vector<vector<int>> a(N, vector<int> (N, 1));\n        for(vector<int>& p : mines) {\n            a[p[0]][p[1]] = 0;\n        }\n        pair<int, int> dp[N][N];\n        for(int i = 0; i < N; i++) {\n            for(int j = 0; j < N; j++) {\n                if(a[i][j] == 1) {\n                    dp[i][j].first = (i == 0 ? 0 : dp[i- 1][j].first) + 1;\n                    dp[i][j].second = (j == 0 ? 0 : dp[i][j - 1].second) + 1;\n                }\n                else {\n                    dp[i][j] = {0, 0};\n                }\n                \n            }\n        }\n        pair<int, int> dp1[N][N];\n        for(int i = N - 1; i >= 0; i--) {\n            for(int j = N - 1; j >= 0; j--) {\n                if(a[i][j] == 1) {\n                    dp1[i][j].first = (i == N - 1 ? 0 : dp1[i + 1][j].first) + 1;\n                    dp1[i][j].second = (j == N - 1 ? 0 : dp1[i][j + 1].second) + 1;\n                }\n                else {\n                    dp1[i][j] = {0, 0};\n                }\n            }\n        }\n        int ans = 0;\n        for(int i = 0; i < N; i++) {\n            for(int j = 0; j < N; j++) {\n                if(a[i][j] == 1) {\n                    int m = min({(i == 0 ? 0 : dp[i - 1][j].first), (j == 0 ? 0 : dp[i][j - 1].second), (i == N - 1 ? 0 : dp1[i + 1][j].first), (j == N - 1 ? 0 : dp1[i][j + 1].second)});\n                    ans = max(ans, m + 1);\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
[]