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
Coding & Algorithms
Software Engineer
Amazon
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Medium

0

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
binary search on answer
monotonic predicate
parallel workers
floor division
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported