Dashboard
LC #875

Koko Eating Bananas

Pattern · ?AmazonGoogleMeta

Problem

Find the minimum eating speed k such that Koko can eat all bananas in h hours.

Constraints

  • 1 ≤ piles.length ≤ h ≤ 10⁹
  • 1 ≤ piles[i] ≤ 10⁹

Example

Input
piles = [3, 6, 7, 11], h = 8
Output
4
Why
At speed 4: [1,2,2,3] hours = 8 total. Speed 3 needs 9 hours (too slow)

Spot the pattern

Which pattern cracks it?

Hints

One at a time
Solve on LeetCode ↗