Minimum Time for a Driver Fleet to Complete N Deliveries
Last updated: November 29, 2026
Quick Overview
Driver i takes time[i] minutes per delivery and drivers work in parallel and independently. Return the minimum number of minutes needed for the fleet to complete at least n deliveries in total.
Amazon
November 29, 20260
0
0 solved
Driver i takes time[i] minutes per delivery and drivers work in parallel and independently. Return the minimum number of minutes needed for the fleet to complete at least n deliveries in total.
A phone screen problem in Amazon's style for Flex and last-mile planning. The interviewer checks that you frame time as the search variable, use floor division to count each driver's trips, and pick a safe upper bound.
What the Interviewer Expects
- Count deliveries by time t as the sum of t // time[i]
- Search t in [1, min(time) * n]
- Short-circuit the count once it reaches n
- Explain why the count is monotonic in t
- State O(m log(min(time) * n))
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you answer it with a min-heap simulation, and when would that be preferable?
- What if each driver also needed a break after every few deliveries?
- How would you assign specific deliveries to drivers once t is known?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs: list time of m positive integers and integer n >= 1. Output: smallest integer t with sum(t // time[i]) >= n....
High-Level Design
By time t, driver i completes t // time[i] deliveries. The total is non-decreasing in t. The fastest driver alone finishes n deliveries by min(time) * n, a valid upper bound. Binary search the lower b...