We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 742c6ab commit 04386fdCopy full SHA for 04386fd
BS/875.md
@@ -0,0 +1,32 @@
1
+## Koko Eating Bananas
2
+
3
+#### Description
4
5
+[link](https://leetcode.com/problems/koko-eating-bananas/)
6
7
+---
8
9
+#### Solution
10
11
+- See Code
12
13
+要注意边界,l要至少从1起步,其他就是标准的Binary Search问题
14
15
16
17
+#### Code
18
19
+O(klog(n))
20
21
+```python
22
+class Solution:
23
+ def minEatingSpeed(self, piles: List[int], H: int) -> int:
24
+ l, r = 1, max(piles)
25
+ while l < r:
26
+ mid = l + (r - l) // 2
27
+ if sum([ceil(x / mid) for x in piles]) > H:
28
+ l = mid + 1
29
+ else:
30
+ r = mid
31
+ return l
32
+```
0 commit comments