# Finding longest subsequence in a given sequence

Suppose given a sequence $$X$$ of numbers. We want to find the longest subsequence $$X′$$ of $$X$$ in which, for each $$i$$,$$2X′[i]

I think this problem is related to the longest increasing subsequence, so I try as follows: Let $$X′[i]$$ is the length of the longest subsequence that ends in the element at index $$X[i]$$ ,

$$X′[i+1]=\max\bigg(1,\max_{ j=1..i \\ 2X[i]−X[i−1]

Is my idea correct?

• We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher.
– D.W.
Apr 30 at 19:41
• cs.stackexchange.com/tags/dynamic-programming/info
– D.W.
Apr 30 at 20:03