You are given an integer array monsters and a 2D integer array boosts.
You must defeat all monsters in sequence from index monsters.length
Each element in boosts is given as [l_i, r_i, v_i], which grants an additional bonus strength of v_i at every index l_i r_i. If multiple boosts cover the same index, their values accumulate.
Starting with an initial strength, to defeat the monster at index
Your effective strength at index monsters[i].
After defeating the monster, your current strength decreases by monsters[i], but it cannot drop below monsters[i]
Return the minimum initial strength required to defeat all monsters in order.
Constraints:
monsters.length
monsters[i]
boosts.length
boosts[i] == [l_i, r_i, v_i]
l_i r_i monsters.length
v_i
You are given an integer array monsters and a 2D integer array boosts.
You must defeat all monsters in sequence from index monsters.length
Each element in boosts is given as [l_i, r_i, v_i], which grants an additional bonus strength of v_i at every index l_i r_i. If multiple boosts cover the same index, their values accumulate.
Starting with an initial strength, to defeat the monster at index
Your effective strength at index monsters[i].
After defeating the monster, your current strength decreases by monsters[i], but it cannot drop below monsters[i]
Return the minimum initial strength required to defeat all monsters in order.
Constraints:
monsters.length
monsters[i]
boosts.length
boosts[i] == [l_i, r_i, v_i]
l_i r_i monsters.length
v_i