2219. Maximum Sum Score of Array

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

On This Page

LeetCode problem 2219

class Solution:
    def maximumSumScore(self, nums: List[int]) -> int:
        s = [0] + list(accumulate(nums))
        return max(max(s[i + 1], s[-1] - s[i]) for i in range(len(nums)))