java · ADVANCED · Public challenge
Slowest Eating Speed
Challenge
There are piles of bananas and h hours. Each hour you choose one pile and eat up to k bananas from it (if the pile has fewer, you eat all of it and waste the rest of the hour). Print the smallest integer k that lets you finish everything within h hours.
Example
Input:
4 8
3 6 7 11
Output: 4
Input: n and h (1 <= n <= h <= 100000), then n pile sizes (1 to 1000000000).
Output: the smallest k.
- Binary search
- Math
- Java