Find the minimum time needed for workers with different speeds to reduce a mountain height to zero.
You are given a positive mountain height and a set of workers. Worker can reduce the mountain by a certain amount over time according to their own speed. In one second, workers may operate in parallel, and the total reduction is the sum of their individual contributions. Your task is to determine the minimum number of seconds required to make the mountain height exactly zero or below.
This is a classic optimization problem: instead of simulating every second directly, determine whether a given amount of time is sufficient, then search for the smallest feasible time.
Return the minimum number of seconds needed to reduce the mountain height to zero.
Example 1
Input
height = 10, workers = [1, 2, 3]
Output
2
Explanation
In 1 second the workers can reduce 1 + 2 + 3 = 6. In 2 seconds they can reduce enough to reach at least 10, so the minimum is 2.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.