|
3 | 3 | * Koko Eating Bananas
|
4 | 4 | **
|
5 | 5 | * Koko loves to eat bananas.
|
6 |
| - * There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours. |
| 6 | + * There are n piles of bananas, the ith pile has piles[i] bananas. |
| 7 | + * The guards have gone and will come back in h hours. |
7 | 8 | *
|
8 | 9 | * Koko can decide her bananas-per-hour eating speed of k.
|
9 | 10 | * Each hour, she chooses some pile of bananas and eats k bananas from that pile.
|
10 |
| - * If the pile has less than k bananas, she eats all of them instead and will not eat any more bananas during this hour. |
| 11 | + * If the pile has less than k bananas, |
| 12 | + * she eats all of them instead and will not eat any more bananas during this hour. |
11 | 13 | *
|
12 | 14 | * Koko likes to eat slowly but still wants to finish eating all the bananas before the guards return.
|
13 | 15 | *
|
14 | 16 | * Return the minimum integer k such that she can eat all the bananas within h hours.
|
| 17 | + * |
| 18 | + * Example 1: |
| 19 | + * Input: piles = [3,6,7,11], h = 8 |
| 20 | + * Output: 4 |
| 21 | + * |
| 22 | + * Example 2: |
| 23 | + * Input: piles = [30,11,23,4,20], h = 5 |
| 24 | + * Output: 30 |
| 25 | + * |
| 26 | + * Example 3: |
| 27 | + * Input: piles = [30,11,23,4,20], h = 6 |
| 28 | + * Output: 23 |
| 29 | + * |
| 30 | + * Constraints: |
| 31 | + * • 1 <= piles.length <= 10^4 |
| 32 | + * • piles.length <= h <= 10^9 |
| 33 | + * • 1 <= piles[i] <= 10^9 |
15 | 34 | **
|
16 | 35 | * https://leetcode.com/problems/koko-eating-bananas/
|
17 | 36 | ***/
|
|
0 commit comments