1911. Maximum Alternating Subsequence Sum Updated: 2024-03-12 1 min read Algorithms , LeetCode On This PageLeetCode 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)