Koko loves to eat bananas. There are n piles of bananas, where the i-th pile has piles[i] bananas. The guards will return in h hours. Koko can decide her bananas-per-hour eating speed k. Each hour, she chooses a pile and eats k bananas from it. If the pile has fewer than k bananas, she eats all of them and waits for the next hour. Return the minimum integer k such that she can eat all the bananas within h hours.
Example 1
Input: piles = [3,6,7,11,8,5,12], h = 10
Output: 7
Explanation: At speed 7, the piles take 1, 1, 1, 2, 2, 1 and 2 hours: 10 hours in total, exactly the limit. At speed 6 they would take 11 hours, so 7 is the minimum.
Example 2
Input: piles = [3,6,7,11], h = 8
Output: 4
Explanation: At speed 4, the piles take 1, 2, 2 and 3 hours: 8 hours in total. At speed 3 they would take 10 hours, which is too slow.
Example 3
Input: piles = [30,11,23,4,20], h = 5
Output: 30
Explanation: There are 5 piles and only 5 hours, so each pile must be finished in a single hour. That requires a speed of at least the largest pile, 30.
The set of eating speeds is **monotonic**: if Koko can finish at speed `k`, she can also finish at every larger speed. That monotonicity lets us binary-search the smallest feasible `k` in `[1, max(piles)]`.
Run checks all cases above. Submit evaluates all test cases.