Skip to content

Practice Minimum Time to Break Locks I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3376
LeetCode Problem

Minimum Time to Break Locks I

Problem Statement

Locks require the energies listed in strength and may be broken in any order. A sword starts with zero energy and a growth factor x = 1. Each minute adds x energy; a lock can be broken once its required energy is reached. Breaking a lock resets the energy to zero and increases x by k. Return the minimum minutes needed to break every lock.

Source: Minimum Time to Break Locks I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
strength = [3,4,1], k = 1
Output
4

# Example 2

Input
strength = [2,5,4], k = 2
Output
5

Constraints

n == strength.length
1 <= n <= 8
1 <= k <= 10
1 <= strength[i] <= 10^6

Related LeetCode Problems

Practice more problems similar to Minimum Time to Break Locks I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.