Search
⌘K

Leetcode 3177. Find the Maximum Length of a Good Subsequence II

Find the longest subsequence of nums that has at most k adjacent changes (i.e., at most k indices i with seq[i] != seq[i+1], equivalently at most k+1 constant runs). The core challenge is maximizing picks under a small transition budget (k ≤ 50), typically solved with dynamic programming over transition count and last chosen value or run.


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.