Search
⌘K

Leetcode 1218. Longest Arithmetic Subsequence of Given Difference

Find the length of the longest subsequence (preserving order) in which consecutive elements differ by a given fixed value. With arr up to 1e5, the core challenge is to compute this efficiently by aggregating the longest arithmetic chain ending at each value (dynamic programming over values).


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.