@@ -0,0 +1,1440 @@
+# Time:  O(nlogr)%0A# Space: O(1)%0A%0A# Koko loves to eat bananas.%0A# There are N piles of bananas, the i-th pile has piles%5Bi%5D bananas.%0A# The guards have gone and will come back in H hours.%0A#%0A# Koko can decide her bananas-per-hour eating speed of K.%0A# Each hour, she chooses some pile of bananas, and eats K bananas from that pile.%0A# If the pile has less than K bananas, she eats all of them instead,%0A# and won't eat any more bananas during this hour.%0A#%0A# Koko likes to eat slowly, but still wants to finish eating%0A# all the bananas before the guards come back.%0A#%0A# Return the minimum integer K such that she can eat all the bananas within H hours.%0A#%0A# Example 1:%0A#%0A# Input: piles = %5B3,6,7,11%5D, H = 8%0A# Output: 4%0A# Example 2:%0A#%0A# Input: piles = %5B30,11,23,4,20%5D, H = 5%0A# Output: 30%0A# Example 3:%0A#%0A# Input: piles = %5B30,11,23,4,20%5D, H = 6%0A# Output: 23%0A#%0A# Note:%0A# - 1 %3C= piles.length %3C= 10%5E4%0A# - piles.length %3C= H %3C= 10%5E9%0A# - 1 %3C= piles%5Bi%5D %3C= 10%5E9%0A%0Aclass Solution(object):%0A    def minEatingSpeed(self, piles, H):%0A        %22%22%22%0A        :type piles: List%5Bint%5D%0A        :type H: int%0A        :rtype: int%0A        %22%22%22%0A        def possible(piles, H, K):%0A            return sum((pile-1)//K+1 for pile in piles) %3C= H%0A%0A        left, right = 1, max(piles)%0A        while left %3C= right:%0A            mid = left + (right-left)//2%0A            if possible(piles, H, mid):%0A                right = mid-1%0A            else:%0A                left = mid+1%0A        return left%0A

Create koko-eating-bananas.py