← 返回 microsoft 的题目列表Longest Palindromic Subsequence
类型:online_judge
Given a string s, find the length of the longest palindromic subsequence in it. You may assume that the maximum length of s is 1000.
Input Specification
The string consists only of lowercase English letters.
Test Cases
Input: s = 'bbbab', Output: 4 (The longest palindromic subsequence is 'bbbb')
Input: s = 'cbbd', Output: 2 (The longest palindromic subsequence is 'bb')
Example
Input
bbbab