Problem
There are piles of bananas, piles[i] in pile i, and h hours until the guards return. Each hour Koko picks one pile and eats up to k bananas from it. If the pile has fewer than k left, she finishes it and waits out the rest of that hour. Return the **smallest whole-number speed k** that lets her eat every banana within h hours.
Example 1
- Input
- piles = [3, 6, 7, 11], h = 8
- Output
- 4
Example 2
- Input
- piles = [30, 11, 23, 4, 20], h = 5
- Output
- 30
Example 3
- Input
- piles = [30, 11, 23, 4, 20], h = 6
- Output
- 23
A pile of p bananas takes ceil(p / k) hours.
Constraints
1 <= piles.length <= 10^4piles.length <= h <= 10^91 <= piles[i] <= 10^9