Python Djikstra, beats 95% runtime
Approach\n1. Treat the value of every cell as a cost of the path between it and an adjacent cell.\n2. Then we run a simplified Djikstra using visiting matrix in
# Approach\n1. Treat the value of every cell as a cost of the path between it and an adjacent cell.\n2. Then we run a simplified Djikstra using visiting matrix instead of the shortest path matrix because we cannot improve the path cost once we come to a cell.\n3. We do not move to a cell if the cost of the path to this cell is `>= health`.\n\n# Code\n```python3 []\nclass Solution:\n    def findSafeWalk(self, grid: List[List[int]], health: int) -> bool:\n        R, C = len(grid), len(grid[0])\n        visited = [[False] * C for _ in range(R)]\n        visited[0][0] = True\n        q = [(grid[0][0], 0, 0)]\n\n        while q:\n            w, r, c = heappop(q)\n            if r == R - 1 and c == C - 1:\n                return True\n\n            for nr, nc in [(-1, 0), (1, 0), (0, -1), (0, 1)]:\n                nr += r\n                nc += c\n                if (0 <= nr < R and \n                    0 <= nc < C and \n                    not visited[nr][nc] and \n                    (nw := w + grid[nr][nc]) < health):\n\n                    visited[nr][nc] = True\n                    heappush(q, (nw, nr, nc))\n        return False\n```
['Python3']