You are given an array of integers strength of length n, representing the strengths of n locks, and an integer k.
You start with an initial energy of
To break a lock with strength strength[i], your current accumulated energy must be greater than or equal to strength[i]. Once a lock is broken:
Your energy resets to
The multiplier factor k (that is, k).
You may break the locks in any order. The time in minutes required to break a lock of strength
Return the minimum total time in minutes required to break all n locks.
Constraints:
n == strength.length
k
strength[i]
You are given an array of integers strength of length n, representing the strengths of n locks, and an integer k.
You start with an initial energy of
To break a lock with strength strength[i], your current accumulated energy must be greater than or equal to strength[i]. Once a lock is broken:
Your energy resets to
The multiplier factor k (that is, k).
You may break the locks in any order. The time in minutes required to break a lock of strength
Return the minimum total time in minutes required to break all n locks.
Constraints:
n == strength.length
k
strength[i]