Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Break Locks II

Minimum Time to Break Locks II gives an array of lock strengths. Energy grows each minute, resets after a break, and its rate increases after every break; return the fewest minutes to break every lock.

Statement

You are given an integer array strength of length n, representing the strengths of n different locks.

Initially, your accumulated energy is 00, and you have an energy generation factor X set to 11.

Every minute, your accumulated energy increases by X. You can choose to break an unbroken lock with a strength of strength[i] at any minute where your current accumulated energy is at least strength[i].

Breaking a lock immediately resets your accumulated energy to 00 and increases the factor X by 11.

Return the minimum number of minutes needed to break all nn locks.

Constraints:

  • n == strength.length

  • 1≤1 \le n ≤80\le 80

  • 1≤1 \le strength[i] ≤106\le 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Break Locks II

Minimum Time to Break Locks II gives an array of lock strengths. Energy grows each minute, resets after a break, and its rate increases after every break; return the fewest minutes to break every lock.

Statement

You are given an integer array strength of length n, representing the strengths of n different locks.

Initially, your accumulated energy is 00, and you have an energy generation factor X set to 11.

Every minute, your accumulated energy increases by X. You can choose to break an unbroken lock with a strength of strength[i] at any minute where your current accumulated energy is at least strength[i].

Breaking a lock immediately resets your accumulated energy to 00 and increases the factor X by 11.

Return the minimum number of minutes needed to break all nn locks.

Constraints:

  • n == strength.length

  • 1≤1 \le n ≤80\le 80

  • 1≤1 \le strength[i] ≤106\le 10^6