Loading problem…
Start in the top-left cell of dungeon and reach the bottom-right by moving only right or down. Entering a cell adds its value to your health: negative values cause damage, positive values heal, and zero changes nothing. This applies to both endpoints.
Health must remain at least 1 after entering every cell. Return the smallest positive initial health that allows some complete route. A later healing cell cannot rescue you if you already reached zero health. Do not modify dungeon.
Example 1:
Example 2:
Example 3: