Search
⌘K

Leetcode 2786. Visit Array Positions to Maximize Score

Starting at index 0, pick an increasing subsequence of positions to maximize the sum of their nums values minus x each time you move between visited positions of different parity. Core challenge: optimize subsequence selection under a transition penalty based on parity (can be solved by tracking best scores for each parity).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.