[CodeChef] Chef and ShopRead more
[CodeChef] The Probability Of WinningRead more
[CodeChef] Rectangles CountingRead more
[CodeChef] MatchesRead more
[Codeforces] Round #529 (Div. 3) D. Circular DanceRead more
[Codeforces] Educational Round 57 (Rated for Div. 2) C. Polygon for the AngleRead more
[Codeforces] Round #530 (Div. 1) A. Sum in the treeRead more
[Codeforces] Round #539 (Div. 1) A. Sasha and a Bit of RelaxRead more
[Codeforces] Round #543 (Div. 2, based on Technocup 2019 Final Round) C. System TestingRead more
[LeetCode] Minimum Time to Kill All Monsters

2403. Minimum Time to Kill All Monsters

You are given an integer array power where power[i] is the power of the ith monster.

You start with 0 mana points, and each day you increase your mana points by gain where gain initially is equal to 1.

Each day, after gaining gain mana, you can defeat a monster if your mana points are greater than or equal to the power of that monster. When you defeat a monster:

  • your mana points will be reset to 0, and
  • the value of gain increases by 1.

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

Read more