875. Koko Eating Bananas (Medium) - TengnanYao/daily_leetcode GitHub Wiki

class Solution(object):
    def minEatingSpeed(self, piles, h):
        """
        :type piles: List[int]
        :type h: int
        :rtype: int
        """
        l, r = 1, max(piles)
        while l < r:
            m = (l + r) // 2
            if sum(ceil(x * 1.0 / m) for x in piles) > h:
                l = m + 1
            else:
                r = m
        return l