Koko loves bananas. She has n piles, where piles[i] is the number of bananas in pile i. Guards return in h hours. Koko can eat at most k bananas per hour from one pile. Find the minimum k such that she finishes all bananas in h hours.
With piles = [3, 6, 7, 11] and h = 8, the answer is 4. At speed 4, pile times are ceil(3/4) + ceil(6/4) + ceil(7/4) + ceil(11/4) = 1 + 2 + 2 + 3 = 8 hours.
What property of this problem makes binary search applicable?
Constraints: , pile sizes up to , .