Leetcode 1027. Longest Arithmetic Subsequence
Find the length of the longest subsequence of nums whose consecutive elements have the same difference (i.e., form an arithmetic progression). With n up to 1000, this is typically solved by pairwise dynamic programming that tracks, for each index and difference, the longest arithmetic subsequence ending there (O(n^2) time).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.