Problem
Return the length of the longest subsequence of s that is a palindrome. A subsequence keeps the original order but may skip characters.
Example 1
- Input
- s = "bbbab"
- Output
- 4
- Why
- "bbbb"
Example 2
- Input
- s = "cbbd"
- Output
- 2
- Why
- "bb"
Example 3
- Input
- s = "agbdba"
- Output
- 5
- Why
- "abdba"
Constraints
1 <= s.length <= 1000s contains only lowercase letters.