There are piles of bananas, piles[i] in pile i. You eat at a speed of k bananas per hour. Each hour you pick one pile and eat up to k bananas from it; if the pile has fewer than k left you finish it and waste the rest of that hour.
Return the smallest whole k that lets you finish every pile within hours hours.
Example 1
Input:
min_eating_speed([3, 6, 7, 11], 8)
Output:
4
Speed 4 takes 1 + 2 + 2 + 3 = 8 hours.
Example 2
Input:
min_eating_speed([30, 11, 23, 4, 20], 5)
Output:
30
With 5 hours for 5 piles you must finish a pile every hour, so the speed is the biggest pile: 30.
1 <= len(piles) <= 2 * 10**4len(piles) <= hours <= 10**91 <= piles[i] <= 10**9No results yet
Run your code to check it against the examples, or submit to run every test.