You are given a 0-indexed integer array representing the number of orders for each restaurant.
You are also given an integer d, representing the number of available dashers.
Each dasher can work only for one restaurant, and must handle all orders assigned to them from that restaurant.
Your task is to find the minimum capacity k such that all orders can be handled by the dashers.
A dasher cannot pick orders from multiple restaurants.
Examples
Example 1
Input: orders = [3, 6, 7, 11], d = 8
Output: 4
Example 2
Input: orders = [30, 11, 23, 4, 20], d = 5
Output: 30
This DoorDash VO problem evaluates your ability to allocate load optimally across a fixed number of workers (dashers).
Each restaurant has a certain number of orders, and each dasher has a maximum capacity k.
We want to find the minimum possible k such that, when distributing orders to dashers, the total number of dashers required does not exceed d.
A key insight:
- For a restaurant with
xorders and dasher capacityk
→ it needsceil(x / k)dashers
The interviewer expects you to use:
✅ Binary search over answer space
✅ Greedy calculation of dasher requirements per capacity
✅ Observations about monotonicity:
- If a capacity
kworks, any larger capacity also works - If a capacity
kfails, any smaller one also fails
This structure makes binary search the ideal approach.
Time complexity should be O(n log max(orders)), which is efficient.
The VOprep team has long accompanied candidates through various major company OAs and VOs, including Doordash, Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for Tiktok or similar engineering-focused companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.