I am kind of confused of the first example, which says "bbbab"'s longest palindromic subsequence is "bbbb". Is this a typo or I didn't get the point?
Thanks in advance!
Check the link here.
I think the problem should state that find a substring which "contains" the longest palindromic sequence.
"abxba", "abyba" and "abzba" are the longest palindromic sequence which is in the substring "abxyzba".
Therefore, the returning answer should be the length of "abxba" which is 5.
The question has a minor clue in it. It says
Longest Palindromic **Subsequence** and not sub - string.
Every sub string is a sub sequence, vice versa is not true.
Both substring and subsequence
ltde // and not substring
Neither sequence nor substring
I learnt it the hard way!