You are playing a game with n levels, numbered from n damage of length n, where damage[i] represents the amount of damage you take at level i.
You are also given an integer armor. You may use your armor ability at most once across all levels. When activated at level i, your armor prevents up to armor damage, meaning you will take damage[i]
To complete the game, your health must remain strictly greater than
Return the minimum initial health needed to complete all levels of the game.
Constraints:
n == damage.length
n
damage[i]
armor
You are playing a game with n levels, numbered from n damage of length n, where damage[i] represents the amount of damage you take at level i.
You are also given an integer armor. You may use your armor ability at most once across all levels. When activated at level i, your armor prevents up to armor damage, meaning you will take damage[i]
To complete the game, your health must remain strictly greater than
Return the minimum initial health needed to complete all levels of the game.
Constraints:
n == damage.length
n
damage[i]
armor