#3286

Find a Safe Walk Through a Grid

expert · 1095 · lc medium +32 · 32.8% accepted · 228 likes · top 10%

Description

You are given m x n binary matrix grid and integer health. Navigate from (0, 0) to (m-1, n-1) moving orthogonally. Entering a cell with value 1 costs 1 health point. Return true if you can arrive with at least 1 health remaining.

Code

1
2
3