Leetcode 875. Koko Eating Bananas
Find the minimum integer eating speed k such that the total hours required (sum over piles of ceil(piles[i]/k)) is ≤ h; because the required hours decreases monotonically with k, this is solved by binary searching k between 1 and max(piles).
Asked at:
DoorDash
Goldman Sachs
Microsoft
Oracle
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late May, 2026
Microsoft
Mid-level
Early April, 2026
Goldman Sachs
Mid-level
Late January, 2026
Goldman Sachs
Mid-level
Just binary search eating speed k from 1 to max(piles). Mention edge case to interviewer where if given h < len(piles), then it will be impossible to finish all piles
Hello Interview Premium
Your account is free and you can post anonymously if you choose.