Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Kill All Monsters

Try to solve the Minimum Time to Kill All Monsters problem.

Statement

You are given an integer array power, where power[i] represents the power required to defeat the iextthi^{ ext{th}} monster.

You start with 00 mana points and have defeated 00 monsters. Each day:

  • You gain 1+k1 + k mana points, where kk is the number of monsters that have already been defeated.

  • Your mana points accumulate from day to day until you choose to defeat a monster.

  • You can defeat an undefeated monster ii on any day as soon as your total accumulated mana is at least power[i].

  • Upon defeating a monster, all accumulated mana points are immediately spent and your mana resets to 00.

Return the minimum number of days needed to defeat all the monsters.

Constraints:

  • 1≤1 \leq power.length ≤17\leq 17

  • 1≤1 \leq power[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Kill All Monsters

Try to solve the Minimum Time to Kill All Monsters problem.

Statement

You are given an integer array power, where power[i] represents the power required to defeat the iextthi^{ ext{th}} monster.

You start with 00 mana points and have defeated 00 monsters. Each day:

  • You gain 1+k1 + k mana points, where kk is the number of monsters that have already been defeated.

  • Your mana points accumulate from day to day until you choose to defeat a monster.

  • You can defeat an undefeated monster ii on any day as soon as your total accumulated mana is at least power[i].

  • Upon defeating a monster, all accumulated mana points are immediately spent and your mana resets to 00.

Return the minimum number of days needed to defeat all the monsters.

Constraints:

  • 1≤1 \leq power.length ≤17\leq 17

  • 1≤1 \leq power[i] ≤109\leq 10^9