Python DFS
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\n\nclass Solution:\n    def findSafeWalk(self, grid: List[List[int]], health: int) -> bool:\n        m=len(grid)\n        n=len(grid[0])\n\n        self.reached=False\n        visited = [[False for _ in range(n)] for _ in range(m)]\n        @cache\n        def dfs(r,c,h):\n            if r<0 or r>=m or c<0 or c>=n or visited[r][c] or h<=0 :return\n            visited[r][c]=True\n            if grid[r][c]==1:\n                h-=1\n                if h<1:\n                    visited[r][c]=False\n                    return \n            if r==m-1 and c==n-1:\n                if h>0:\n                    self.reached=True\n                visited[r][c]=False\n                return\n            x = [1, -1, 0, 0]\n            y = [0, 0, 1, -1]\n\n            for xi,yi in zip(x,y):\n                dfs(r+yi,c+xi,h)\n            visited[r][c]=False\n        dfs(0,0,health)\n        return self.reached\n        \n\n\n            \n        \n```
['Dynamic Programming', 'Depth-First Search', 'Python3']