What is the meaning of example 1?


  • 5
    L

    Hi,

    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!


  • 5

    @lakecarrot
    Check the link here.
    I think the problem should state that find a substring which "contains" the longest palindromic sequence.
    For example:
    Given "abxyzbahj",
    "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.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.