How to find the longest continuous subsequence whose reverse is also a subsequence
Posted
by iecut
on Stack Overflow
See other posts from Stack Overflow
or by iecut
Published on 2010-03-19T04:45:50Z
Indexed on
2010/03/20
2:41 UTC
Read the original article
Hit count: 434
Suppose I have a sequence x1,x2,x3.....xn, and I want to find the longest continuous subsequence xi,xi+1,xi+2......xi+k, whose reverse is also a subsequence of the given sequence. And if there are multiple such subsequences, then I also have to find the first.
ex:- consider the sequences:
abcdefgedcg here i=3 and k=2
aabcdddd here i=5, k=3
I tried looking at the original longest common subsequence problem, but that is used to compare the two sequences to find the longest common subsequence.... but here is only one sequence from which we have to find the subsequences. Please let me know what is the best way to approach this problem, to find the optimal solution.
© Stack Overflow or respective owner