Had trouble understanding other solutions: here's mine. (c++)
Traverse each value in the matrix from each direction. calculate the distance from each mine. return the maximum distance after the last traversal.\n\nclass Sol
Traverse each value in the matrix from each direction. calculate the distance from each mine. return the maximum distance after the last traversal.\n```\nclass Solution {\npublic:\n    int orderOfLargestPlusSign(int N, vector<vector<int>>& mines) {\n        vector<vector<int>> minefield(N, vector(N, 1));\n        for( auto mine : mines){\n            minefield[mine[0]][mine[1]] = 0;\n        }\n        \n        for(int y = 0; y < N; ++y) {\n            int count = 0;\n            for(int x = 0; x < N; ++x) {\n                if(minefield[x][y] !=0) {\n                    minefield[x][y] = ++count;\n                } else {\n                    count = 0;\n                }\n            }\n            count = 0;\n            for(int x= N-1; x >=0; --x) {\n                if(minefield[x][y] != 0) {\n                    minefield[x][y] = min(minefield[x][y], ++count);\n                } else {\n                    count = 0;\n                }\n            }\n        }\n        \n        int ans = 0;\n        \n        for(int x = 0; x < N; ++x){\n            int count = 0;\n            for(int y = 0; y < N; ++y){\n                if(minefield[x][y] != 0){\n                    minefield[x][y] = min(minefield[x][y], ++count);\n                } else {\n                    count = 0;\n                }\n            }\n            count = 0;\n            for(int y = N-1; y >= 0; --y){\n                if(minefield[x][y] != 0){\n                    ans = max(min(minefield[x][y], ++count), ans);\n                } else {\n                    count = 0;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
[]