Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Break Locks II

Try to solve the Minimum Time to Break Locks II problem.

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

Try to solve the Minimum Time to Break Locks II problem.

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