Koko Eating Bananas

Koko has several piles of bananas and h hours to eat them all. At an integer speed k, she chooses one non-empty pile each hour and eats up to k bananas from…

Koko has several piles of bananas and `h` hours to eat them all. At an integer speed `k`, she chooses one non-empty pile each hour and eats up to `k` bananas from it. If fewer than `k` bananas remain in that pile, the partial final hour still counts as one whole hour. Return the minimum integer speed `k` that lets Koko finish every pile within `h` hours.

- `1 <= piles.length <= 10^4` - `piles.length <= h <= 10^9` - `1 <= piles[i] <= 10^9`

Example 1: input piles = [3,6,7,11], h = 8; output 4. Speed 4 needs 1 + 2 + 2 + 3 = 8 hours, while speed 3 needs 10 hours.

Example 2: input piles = [30,11,23,4,20], h = 5; output 30. Five piles in five hours means every pile must finish in one hour.

Category: Binary Search. Topic: arrays. Difficulty: Medium. Patterns: binary-search-on-answer.