O76
Koko Eating Bananas
Problem Statement & Objective
Koko loves to eat bananas. Return the minimum integer k such that she can eat all the bananas within h hours.
Function Signature (Python)
min_eating_speed(piles: list[int], h: int) -> intInput & Output Contract
Output Rule:Minimum saatlik hız k (tam sayı).
System Constraints
1 <= yiginlar.length <= 10^4
yiginlar.length <= h <= 10^9
1 <= yiginlar[i] <= 10^9Example Execution Walkthrough
yiginlar = [3, 6, 7, 11], h = 8 -> k = 4 hızında: ceil(3/4)+ceil(6/4)+ceil(7/4)+ceil(11/4) = 1+2+2+3 = 8 saat -> cevap: 4Example Test Scenarios (3)
Example 1
Input:
[[3,6,7,11],8]Expected Output:
4Example 2: h = n
Input:
[[30,11,23,4,20],5]Expected Output:
30Example 3
Input:
[[30,11,23,4,20],6]Expected Output:
23