Search
⌘K
Leetcode 1911. Maximum Alternating Subsequence Sum
Choose a subsequence (order preserved) of nums to maximize its alternating sum — the sum of elements at even positions minus the sum at odd positions after reindexing. With n up to 1e5, this is solved by a linear DP/greedy that decides for each element whether to include it as a positive (even) or negative (odd) contribution.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.