C++ | Dp | Easy | Faster | only O(n^2)
\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int n, vector<vector<int>>& mines) {\n        //jai shri ram\n        int ans=0;\n        vector<boo
```\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int n, vector<vector<int>>& mines) {\n        //jai shri ram\n        int ans=0;\n        vector<bool>block(25*int(1e4)+1,0);\n        vector<vector<int>>dp(n,vector<int>(n,0));\n        for(auto x:mines){\n            int a=x[0],b=x[1];\n            block[a*n+b]=true;\n        }\n        for(int i=0;i<n;i++){\n            int sum=0;\n            for(int j=0;j<n;j++){\n                if(block[i*n+j]){\n                    sum=0;\n                }else {\n                    sum+=1;\n                }\n                dp[i][j]=sum;\n            }\n        }\n        for(int j=0;j<n;j++){\n            int sum=0;\n            for(int i=0;i<n;i++){\n                if(block[i*n+j]){\n                    sum=0;\n                }else sum+=1;\n                dp[i][j]=min(dp[i][j],sum);\n            }\n        }\n        for(int j=n-1;j>=0;j--){\n            int sum=0;\n            for(int i=n-1;i>=0;i--){\n                if(block[i*n+j]){\n                    sum=0;\n                }else sum+=1;\n                dp[i][j]=min(dp[i][j],sum);\n            }\n        }\n        for(int i=n-1;i>=0;i--){\n            int sum=0;\n            for(int j=n-1;j>=0;j--){\n                if(block[i*n+j]){\n                    sum=0;\n                }else sum+=1;\n                dp[i][j]=min(dp[i][j],sum);\n                ans=max(ans,dp[i][j]);\n            }\n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'C', 'C++']