1953. Maximum Number of Weeks for Which You Can Work

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1953

class Solution:
    def numberOfWeeks(self, milestones: List[int]) -> int:
        mx, s = max(milestones), sum(milestones)
        rest = s - mx
        return rest * 2 + 1 if mx > rest + 1 else s