516. Longest Palindromic Subsequence
https://leetcode.com/problems/longest-palindromic-subsequence/
Problem
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000.
Example 1: Input:
Output:
One possible longest palindromic subsequence is "bbbb".
Example 2: Input:
Output:
One possible longest palindromic subsequence is "bb".
Constraints:
1 <= s.length <= 1000
s
consists only of lowercase English letters.
Solution
1. Using LCS
2. Optimized
#dp
#lcs
Last updated
Was this helpful?