Trains the technique from
LeetCode 3733Minimum Time to Complete All DeliveriesThis 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.
Two vans make deliveries. Van i has d[i] drops to make and needs r[i] minutes for each drop it makes.
The two vans work at the same time as each other. Either van may take over any number of the other's drops, so the drops may be shared out between them however you like, but every drop must be made.
Return the fewest minutes until all the drops are done, which is the longer of the two vans' working times.
Example 1
There are 41 drops between them. In 63 minutes the first van manages 12 and the second 21, which is 33 and not enough; the smallest allowance that covers all 41 is what is returned.
Example 2
Ten drops between two vans of the same speed means five each, at two minutes apiece.
Example 3
Eleven drops in all. The fast van is worth more than three of the slow one's, so it takes most of them, and the two finish together as nearly as whole drops allow.
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(d: list[int], r: list[int]) -> int:public long minimumTime(int[] d, int[] r)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.