Python TLE DP straighforward approach O(N^2)
Not sure, if there is a better way, but Python was giving TLE, for the straighforward DP approach\n\n\n    def orderOfLargestPlusSign(self, N, mines):\n        
Not sure, if there is a better way, but Python was giving TLE, for the straighforward DP approach\n\n```\n    def orderOfLargestPlusSign(self, N, mines):\n        if N == 1: return 0 if mines else 1\n        info = [[[0] * 4 for _ in range(N)] for _ in range(N)]\n        res = 0\n        s = {(mine[0], mine[1]) for mine in mines}\n        \n        for x in range(N):\n            for y in range(N):\n                if (x,y) not in s:\n                    info[x][y][0], info[x][y][1] = 1, 1\n                    if x-1 >= 0: info[x][y][0] = info[x-1][y][0] + 1 # UP\n                    if y-1 >= 0: info[x][y][1] = info[x][y-1][1] + 1 # LEFT\n\n        for x in range(N-1, -1, -1):\n            for y in range(N-1, -1, -1):\n                if (x, y) not in s:\n                    info[x][y][2], info[x][y][3] = 1, 1\n                    if x+1 < N: info[x][y][2] = info[x+1][y][2] + 1 # DOWN\n                    if y+1 < N: info[x][y][3] = info[x][y+1][3] + 1 # RIGHT\n\n                    temp = []\n                    temp.append(info[x - 1][y][0] if x - 1 >= 0 else 0)\n                    temp.append(info[x][y - 1][1] if y - 1 >= 0 else 0)\n                    temp.append(info[x + 1][y][2] if x + 1 < N else 0)\n                    temp.append(info[x][y + 1][3] if y + 1 < N else 0)\n\n                    res = max([min(temp) + 1, res])\n        return res\n```
[]