You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a string s, find the longest palindromic subsequence's length in s.
5
+
6
+
A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
7
+
8
+
9
+
Example 1:
10
+
11
+
Input: s = "bbbab"
12
+
Output: 4
13
+
Explanation: One possible longest palindromic subsequence is "bbbb".
14
+
15
+
Example 2:
16
+
17
+
Input: s = "cbbd"
18
+
Output: 2
19
+
Explanation: One possible longest palindromic subsequence is "bb".
0 commit comments