class Solution: def shipWithinDays(self, weights: 'List[int]', D: int) -> int: left = max(weights)#不能小于最重的单个货物 right = sum(weights)#不用大于全部货物的总重量 while left < right:#以此为左和右边界,向中间查询 cur = 0 #当前批次装载重量 need = 1 #所需时间 mid = (left + right) // 2 for w in w…