C++ (4 approaches - Just like how an interview goes)
See the HINGLISH explanation on my LinkedIn page : https://www.linkedin.com/groups/12559380/\n\n\n//Approach-0 (Brute Force - Naive approach which comes to our 
See the HINGLISH explanation on my LinkedIn page : https://www.linkedin.com/groups/12559380/\n\n```\n//Approach-0 (Brute Force - Naive approach which comes to our mind instantly) O(n^3)\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int n, vector<vector<int>>& mines) {\n        vector<vector<int>> t(n, vector<int>(n, 1));\n        \n        for(vector<int>& vec : mines) {\n            t[vec[0]][vec[1]] = 0;\n        }\n        \n        int maxC = 0;\n        for(int i = 0; i<n; i++) {\n            for(int j = 0; j<n; j++) {\n\t\t\t\t//As soon as you see one, find 1 to its left, right, top and bottom\n                if(t[i][j] == 1) {\n                    int k = j+1;\n                    int right = 0, left = 0, up = 0, down = 0;\n                    while(k < n && t[i][k] == 1) {\n                        k++;\n                        right++;\n                    }\n                    \n                    k = j-1;\n                    while(k >= 0 && t[i][k] == 1) {\n                        k--;\n                        left++;\n                    }\n                    \n                    k = i-1;\n                    while(k >= 0 && t[k][j] == 1) {\n                        k--;\n                        up++;\n                    }\n                    \n                    k = i+1;\n                    while(k < n && t[k][j] == 1) {\n                        k++;\n                        down++;\n                    }\n                    \n                    int minL = min({left, right, up, down});\n                    maxC = max(maxC, minL+1);\n                }\n            }\n        }\n        return maxC;\n    }\n};\n```\n\n```\n//Approach-1 (Improving your brute force) O(n^3)\n/Approach-1 (Brute Force : O(n^3))\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int n, vector<vector<int>>& mines) {\n        if(n*n == mines.size())\n            return 0;\n        \n        int t[n][n];\n        for(int i = 0; i<n; i++) {\n            for(int j = 0; j<n; j++) {\n                t[i][j] = 1;\n            }\n        }\n        \n        for(vector<int>& vec : mines)\n            t[vec[0]][vec[1]] = 0;\n        \n        int ans = 0;\n        for(int i = 0; i<n; i++) {\n            for(int j = 0; j<n; j++) {\n                if(t[i][j] == 0) continue;\n                \n                //Taking [i][j] as center try to expand it (up, down, left, right)\n\t\t\t\t/*\n\t\t\t\t\tup = i-expand\n\t\t\t\t\tdown = i + expand\n\t\t\t\t\tleft = j - expand\n\t\t\t\t\tright = j + expand\n\t\t\t\t*/\n                int expand = 0;\n                while(true) {\n                    expand++;\n                    if(i - expand < 0 || j - expand < 0 || i + expand >= n || j + expand >= n)\n                        break;\n                    \n                    if(t[i-expand][j] == 0 || t[i][j-expand] == 0 || t[i+expand][j] == 0 || t[i][j+expand] == 0)\n                        break;\n                }\n                \n                ans = max(ans, expand);\n            }\n        }\n        return ans;\n    }\n};\n```\n\n```\n//Approach-2 (Dynamic Programming, Time : O(n^2), Space : O(n^2))\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int n, vector<vector<int>>& mines) {\n        vector<vector<int>> t(n, vector<int>(n, 1));\n        for(vector<int>& vec : mines) {\n            t[vec[0]][vec[1]] = 0;\n        }\n        \n        int ans = 0;\n        vector<vector<int>> left, right, top, bottom;\n        /*\n            left[i][j]  = count of 1s in the left direction of t[i][j]\n            right[i][j] = count of 1s in the right direction of t[i][j]\n            so on..\n        */\n        left = right = top = bottom = t;\n        \n        for(int i = 0; i<n; i++) {\n            for(int j = 0; j<n; j++) {\n                if(i > 0 && top[i][j]) top[i][j] += top[i-1][j];\n                if(j > 0 && left[i][j])  left[i][j]  += left[i][j-1];\n                \n                /*\n                    You can write a seperate loop for filling right and bottom\n                    Because in right and bottom you will have to traverse from\n                    bottom right to top\n                    BUT, you can manipulate the index here only to achieve that\n                */\n                \n                /*\n                    As i moves from top to down, j moves from left to right\n                    \n                    n-i-1 will move from bottom to up\n                    n-j-1 will move from right to left\n                */\n                int x = n-i-1;\n                int y = n-j-1;\n                if(x < n-1 && bottom[x][y]) bottom[x][y] += bottom[x+1][y];\n                if(y < n-1 && right[x][y])  right[x][y]   += right[x][y+1];\n            }\n        }\n        \n        /*\n            Now, for any i and j, we need to find the minimum of its (left, right, bottom and up)\n            And among all those minimum, we need to find the maximum\n        */\n        \n        for(int i = 0; i<n; i++) {\n            for(int j = 0; j<n; j++) {\n                int minL = min({left[i][j], right[i][j], top[i][j], bottom[i][j]});\n                ans = max(ans, minL);\n            }\n        }\n        \n        return ans;\n    }\n};\n```\n\n```\n//Approach-3 (Dynamic Programming, Time : O(n^2), Space : O(n^2)\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int n, vector<vector<int>>& mines) {\n        if(n*n == mines.size())\n            return 0;\n        \n        int t[n][n];\n        for(int i = 0; i<n; i++) {\n            for(int j = 0; j<n; j++) {\n                t[i][j] = n;\n            }\n        }\n        \n        for(vector<int>& vec : mines)\n            t[vec[0]][vec[1]] = 0;\n        \n        int ans = 0;\n        \n        for(int i = 0; i<n; i++) {\n            //t[][] will be updated to minimum of its left, right, up and down (count of 1s)\n            \n            //Look for longest streak of 1 at its left\n            int left = 0;\n            for(int j = 0; j < n; j++) {\n                left = t[i][j] == 0 ? 0 : left+1;\n                t[i][j] = min(t[i][j], left);\n            }\n            \n            //Look for longest streak of 1 at its right\n            int right = 0;\n            for(int j = n-1; j>=0; j--) {\n                right = t[i][j] == 0 ? 0 : right+1;\n                t[i][j] = min(t[i][j], right);\n            }\n            \n            //Look for longest streak of 1 at its up\n            int up = 0;\n            for(int k = 0; k < n; k++) {\n                up = t[k][i] == 0 ? 0 : up+1;\n                t[k][i] = min(t[k][i], up);\n            }\n            \n            //Look for longest streak of 1 at its down\n            int down = 0;\n            for(int k = n-1; k >= 0; k--) {\n                down = t[k][i] == 0 ? 0 : down+1;\n                t[k][i] = min(t[k][i], down);\n            }\n        }\n        \n        //Finally, find the max one\n        for (int i = 0; i < n; i++) {\n            for (int j = 0; j < n; j++) {\n                ans = max(ans, t[i][j]);\n            }\n        }\n        \n        return ans;\n    }\n};\n```
[]