CPP | EASY-TO-GRASP
\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        int m=n;\n        for(auto i: mines){\n            a[i[0]][i[1]]=0;\n        }\n        int dp[n][m][4];\n        for(int i=0;i<n;i++){\n            for(int j=0;j<m;j++){\n                for(int k=0;k<4;k++){\n                    dp[i][j][k]=0;\n                    if(i==0 or j==0 or i==n-1 or j==m-1)\n                        dp[i][j][k]=a[i][j];\n                }\n            }\n        }\n        // [0]-top\n        // [1]-bottom\n        // [2]-right\n        // [3]-left\n        int maxx=0;\n        for(int i=0;i<n;i++){\n            for(int j=0;j<m;j++){\n                if(j!=0){\n                    dp[i][j][0]=(a[i][j]?1+dp[i][j-1][0]:0);\n                }\n                if(i!=0){\n                    dp[i][j][3]=(a[i][j]?1+dp[i-1][j][3]:0);\n                }\n            }\n        }\n        for(int i=n-1;i>=0;i--){\n            for(int j=m-1;j>=0;j--){\n                if(j!=m-1){\n                    dp[i][j][2]=(a[i][j]?1+dp[i][j+1][2]:0);\n                }\n                if(i!=n-1){\n                    dp[i][j][1]=(a[i][j]?1+dp[i+1][j][1]:0);\n                }\n            }\n        }\n        for(int i=0;i<n;i++){\n            for(int j=0;j<m;j++){\n                if(a[i][j])maxx=max(maxx,1);\n                maxx=max(maxx,min({dp[i][j][0],dp[i][j][1],dp[i][j][2],dp[i][j][3]}));\n            }\n        }\n        return maxx;\n    }\n};\n```
[]