Minimum banana eating speed
A monkey eats bananas from n piles; pile i has piles[i] bananas. It picks an eating speed k bananas/hour. Each hour it eats from a single pile; if that pile has fewer than k bananas it eats them all and stops for that hour. Given it has h hours before the guards return, return the minimum integer speed k so it finishes all bananas in time. Constraints: 1 <= n <= 10^4, n <= h <= 10^9, 1 <= piles[i] <= 10^9.
Implement
min_eating_speed(piles: list[int], h: int) → intExamples
in
[[3,6,7,11],8]out4What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 22 min
solution.py
InputExpectedGot
[[3,6,7,11],8]4not run yetsample