[LeetCode] Longest Palindromic Subsequence II

1 · · March 28, 2022, 1:15 a.m.
1682. Longest Palindromic Subsequence II A subsequence of a string s is considered a good palindromic subsequence if: It is a subsequence of s. It is a palindrome (has the same value if reversed). It has an even length. No two consecutive characters are equal, except the two middle ones. For example, if s = “abcabcabb”, then “abba” is considered a good palindromic subsequence, while “bcb” (not even length) and “bbbb” (has equal consecutive characters) are not. Given a string s, return the len...