[Python3] dp
\n\nclass Solution:\n    def orderOfLargestPlusSign(self, N: int, mines: List[List[int]]) -> int:\n        mines = {(x, y) for x, y in mines} # O(1) lookup \n  
\n```\nclass Solution:\n    def orderOfLargestPlusSign(self, N: int, mines: List[List[int]]) -> int:\n        mines = {(x, y) for x, y in mines} # O(1) lookup \n        \n        top = [[0]*N for _ in range(N)]\n        left = [[0]*N for _ in range(N)]\n        for i in range(N):\n            for j in range(N): \n                if (i, j) in mines: continue \n                top[i][j] = 1 + top[i-1][j] if i > 0 else 1\n                left[i][j] = 1 + left[i][j-1] if j > 0 else 1\n        \n        right = [[0]*N for _ in range(N)]\n        bottom = [[0]*N for _ in range(N)]\n        for i in reversed(range(N)):\n            for j in reversed(range(N)): \n                if (i, j) in mines: continue \n                right[i][j] = 1 + right[i][j+1] if j+1 < N else 1\n                bottom[i][j] = 1 + bottom[i+1][j] if i+1 < N else 1\n        \n        return max(min(top[i][j], left[i][j], right[i][j], bottom[i][j]) for i in range(N) for j in range(N))\n```\n\nA more concise but less comprehensive implementation is given below \n```\nclass Solution:\n    def orderOfLargestPlusSign(self, n: int, mines: List[List[int]]) -> int:\n        dp = [[n] * n for _ in range(n)]\n        for i, j in mines: dp[i][j] = 0\n        \n        for i in range(n):\n            ll = dd = rr = uu = 0 \n            for j in range(n): \n                dp[i][j] = min(dp[i][j], ll := ll+1 if dp[i][j] else 0)\n                dp[j][i] = min(dp[j][i], dd := dd+1 if dp[j][i] else 0)\n                dp[i][~j] = min(dp[i][~j], rr := rr+1 if dp[i][~j] else 0)\n                dp[~j][i] = min(dp[~j][i], uu := uu+1 if dp[~j][i] else 0)\n                    \n        return max(map(max, dp))\n```
['Python3']