Trains the technique from
LeetCode 2895Minimum Processing TimeThis 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 inspects parcels at a row of benches, one bench per entry of bench_ready. Bench i is unusable until minute bench_ready[i], when it opens.
Every bench is staffed by exactly four inspectors who work side by side, and each inspector handles exactly one parcel from start to finish on their own. jobs[j] is how many minutes parcel j takes to inspect. There are exactly four times as many parcels as benches, so every inspector ends up with one parcel and no parcel is left over. You decide which parcel each inspector takes.
An inspector at bench i who takes a parcel needing t minutes begins at minute bench_ready[i] and is done at minute bench_ready[i] + t, whatever the other three inspectors at that bench are doing.
Return the earliest minute at which the last parcel can be finished.
Example 1
Give the parcels needing 8, 7, 5 and 4 minutes to the bench that opens at minute 8, finishing at minutes 16, 15, 13 and 12. Give the parcels needing 3, 2, 2 and 1 minutes to the bench that opens at minute 10, finishing at minutes 13, 12, 12 and 11. The last parcel is done at minute 16.
Example 2
The bench opening at minute 1 takes the parcels needing 9, 8, 7 and 6 minutes and finishes at minute 10. The bench opening at minute 2 takes 6, 5, 4 and 3 and finishes at minute 8. The bench opening at minute 3 takes 2, 2, 1 and 1 and finishes at minute 5.
Example 3
Every parcel needs one minute, and four of them must wait for the bench that opens at minute 100, so the last parcel is done at minute 101.
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 earliest_finish(bench_ready: list[int], jobs: list[int]) -> int:public int earliestFinish(List<Integer> benchReady, List<Integer> jobs)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.