Python Top Down + Memoization -> Bottom Up DP Solution
Top Down\n\nclass Solution:\n    def orderOfLargestPlusSign(self, n: int, mines: List[List[int]]) -> int:\n        \n        memo = {}\n        \n        def re
Top Down\n```\nclass Solution:\n    def orderOfLargestPlusSign(self, n: int, mines: List[List[int]]) -> int:\n        \n        memo = {}\n        \n        def recurse(r, c, direction):\n            \n            if (r, c, direction) in memo:\n                return memo[(r, c, direction)]\n            \n            if not 0 <= r < n or not 0 <= c < n:\n                return 0\n            \n            if (r, c) in mines_set:\n                return 0\n            \n            if direction == "L":\n                res = 1 + recurse(r, c - 1, "L")\n            elif direction == "R":\n                res = 1 + recurse(r, c + 1, "R")\n            elif direction == "U":\n                res = 1 + recurse(r - 1, c, "U")\n            elif direction == "D":\n                res = 1 + recurse(r + 1, c, "D")\n        \n            memo[(r, c, direction)] = res\n            \n            return res\n        \n        mines_set = set()\n        \n        for x, y in mines:\n            mines_set.add((x, y))\n        \n        max_res = 0\n        \n        for i in range(n):\n            for j in range(n):\n                curr_res = min(\n                    recurse(i, j, "L"),\n                    recurse(i, j, "R"),\n                    recurse(i, j, "U"),\n                    recurse(i, j, "D")\n                )\n                \n                max_res = max(max_res, curr_res)\n\n        return max_res\n        \n```\n\nBottom Up\n\n```\nclass Solution:\n    def orderOfLargestPlusSign(self, n: int, mines: List[List[int]]) -> int:\n\n        mines_set = set()\n        \n        for x, y in mines:\n            mines_set.add((x, y))\n        \n        dp = [[[0] * 4 for _ in range(n + 1)] for _ in range(n + 1)]\n        \n        max_res = 0\n\n        for r in range(n - 1, -1, -1):\n            for c in range(n - 1, -1, -1):\n                \n                for direction in [1, 3]:\n\n                    if (r, c) in mines_set:\n                        continue\n                        \n                    if direction == 1:\n                        dp[r][c][direction] = 1 + dp[r][c + 1][1]\n                    elif direction == 3:\n                        dp[r][c][direction] = 1 + dp[r + 1][c][3]\n\n\n        for r in range(n):\n            for c in range(n):\n                \n                for direction in [0, 2]:\n\n                    if (r, c) in mines_set:\n                        continue\n                    \n                    if direction == 0:\n                        dp[r][c][direction] = 1 + dp[r][c - 1][0]\n                    elif direction == 2:\n                        dp[r][c][direction] = 1 + dp[r - 1][c][2]\n\n                max_res = max(max_res, min(dp[r][c]))\n                    \n\n        return max_res\n        \n```
['Dynamic Programming', 'Memoization', 'Python3']