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

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]<X[i+1]}\bigg(X′[j]+1\bigg)\bigg)$$

Is my idea correct?

  • $\begingroup$ 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. $\endgroup$
    – D.W.
    Apr 30 at 19:41
  • $\begingroup$ cs.stackexchange.com/tags/dynamic-programming/info $\endgroup$
    – D.W.
    Apr 30 at 20:03


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.