Back to problems

Dungeon Health

Algorithm · Goldman Sachs · Hard

You are given a grid dungeon with m rows and n columns. Each cell dungeon[i][j] contains an integer: A negative value reduces the knight's current health by that amount. A value of 0 leaves the current health unchanged. A positive value restores that much health. The knight begins at the top-left cell (0, 0) and must reach the bottom-right cell (m - 1, n - 1). From any cell, it can only move one step to the right or one step downward. The knight's health must always be at…

Checking your access…