python leetcode 每日打卡之1052

class Solution:
    def maxSatisfied(self, customers: List[int], grumpy: List[int], X: int) -> int:
        A = sum(customers)
        for i in range(len(customers)):
            if grumpy[i] == 0:
                customers[i] = 0
        res = sum(customers[:X])
        tmp = res
        for i in range(len(customers) - X):
            tmp = tmp - customers[i] + customers[i + X]
            res = max(res , tmp)
        return A + res - sum(customers)

 

上一篇:异步_CompletableFuture


下一篇:Netty异步模型