Slowest Picking Rate That Clears Every Bin Before Shift End
Last updated: November 29, 2026
Quick Overview
An associate must empty bins with given unit counts within h hours. Each hour they pick from a single bin at rate r units per hour (if the bin has fewer, they finish it and idle). Return the minimum integer rate r that finishes all bins within h hours.
Amazon
November 29, 20260
0
0 solved
An associate must empty bins with given unit counts within h hours. Each hour they pick from a single bin at rate r units per hour (if the bin has fewer, they finish it and idle). Return the minimum integer rate r that finishes all bins within h hours.
The canonical Amazon binary-search-on-answer pattern, framed around pick rates in a fulfillment center. Interviewers want you to identify the monotonic feasibility check and the correct search bounds without being told it is a binary search problem.
What the Interviewer Expects
- Notice that a higher rate never takes more hours, so feasibility is monotonic
- Write hours(r) = sum of ceil(bin / r)
- Search r in [1, max(bins)]
- Use integer ceiling without floating point
- State O(n log max) time
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
- What if the associate could split an hour across two bins?
- How would you handle bins arriving over time?
- What if there were several associates working in parallel?
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 of positive integers bins (n of them) and integer h >= n. Output: smallest integer r >= 1 such that sum(ceil(b / r)) <= h. Because h >= n, r = max(bins) is always feasible....
High-Level Design
Define feasible(r) as sum of ceil(b / r) <= h. As r grows, each term is non-increasing, so feasibility flips from False to True exactly once. Binary search over r in [1, max(bins)] for the first feasi...