1822. Longest Palindromic Subsequence II

Medium
String
Dynamic Programming

Description

Hints

Hint 1
As with any good dp problem that uses palindromes, try building the palindrome from the edges
Hint 2
The prime point is to check that no two adjacent characters are equal, so save the past character while building the palindrome.

Statistics

Acceptance
50.4%
Submissions
12,721
Accepted
6,411