Skip to content

Practice Minimum Number of Seconds to Make Mountain Height Zero

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

Medium#3296
LeetCode Problem

Minimum Number of Seconds to Make Mountain Height Zero

Problem Statement

Workers operate simultaneously to reduce mountainHeight to zero. If worker i removes x units of height, that worker spends workerTimes[i] * (1 + 2 + ... + x) seconds, and may remove zero units. The elapsed time is the maximum time spent by any worker. Allocate all height reductions among the workers to minimize that elapsed time and return it.

Source: Minimum Number of Seconds to Make Mountain Height Zero on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
mountainHeight = 4, workerTimes = [2,1,1]
Output
3

# Example 2

Input
mountainHeight = 10, workerTimes = [3,2,2,4]
Output
12

# Example 3

Input
mountainHeight = 5, workerTimes = [1]
Output
15

Constraints

1 <= mountainHeight <= 10^5
1 <= workerTimes.length <= 10^4
1 <= workerTimes[i] <= 10^6

Related LeetCode Problems

Practice more problems similar to Minimum Number of Seconds to Make Mountain Height Zero.

Review your practice with PhantomCodeAI

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