1872. Stone Game VIII

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 1872

class Solution:
    def stoneGameVIII(self, stones: List[int]) -> int:
        s = list(accumulate(stones))
        f = s[-1]
        for i in range(len(s) - 2, 0, -1):
            f = max(f, s[i] - f)
        return f