Search
⌘K

Leetcode 174. Dungeon Game

Given a grid of integers (positive heal, negative damage) and moves only right or down, find the minimum positive initial health so the running health never drops to zero or below when reaching the bottom-right. This is solved by reverse dynamic programming computing, for each cell, the minimum health required on entry (at least 1) based on the requirements of its right and down neighbors.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.