1911. Maximum Alternating Subsequence Sum Обновлено: 2024-03-12 1 мин Algorithms , LeetCode СодержаниеLeetCode problem 1911class Solution: def maxAlternatingSum(self, nums: List[int]) -> int: f = g = 0 for x in nums: f, g = max(g - x, f), max(f + x, g) return max(f, g)