You are navigating through a grid of size m x n, represented by cells, where each cell contains either 0 (safe) or 1 (dangerous).
You start at (0, 0) with life points and can move up, down, left, or right.
Each time you enter a dangerous cell (1), your life decreases by 1.
You cannot move once your life drops to 0 or below.
Return true if it’s possible to reach the target (m - 1, n - 1) while still alive, otherwise return false.
Input: cells = [[0,1,0],[0,0,1],[1,0,0]], life = 2
Output: true
Input: cells = [[1,1],[1,0]], life = 1
Output: false
Input: cells = [[0,0,0],[0,1,0],[1,0,0]], life = 2
Output: true
Accepted:
Submission: