Trains the technique from
LeetCode 1723Find Minimum Time to Finish All JobsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A depot has runs to hand out, and runs[i] is how long run i takes. Every run goes to exactly one of k drivers, and a driver's shift is the total time of the runs handed to them. A driver may end up with no runs at all.
Hand out every run so that the longest shift is as short as it can be, and return that length.
Example 1
Giving one driver the two runs of 3 and the other the three runs of 2 makes both shifts 6, and since the whole total is 12 no shorter longest shift is possible.
Example 2
One run each, so both shifts come to 5.
Example 3
Some driver has to take the run of 10 whatever else happens, so the longest shift is at least that, and the other driver can take both short runs.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def minimum_time_required(runs: list[int], k: int) -> int:public int minimumTimeRequired(int[] runs, int k)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.