Search
⌘K

Leetcode 3202. Find the Maximum Length of Valid Subsequence II

Find the longest subsequence (order preserved) of nums such that every adjacent pair sum has the same remainder modulo k. This reduces to a DP/greedy over possible target remainders, tracking for each remainder the best subsequence length you can end with given the last element's residue.


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.