How do you find the longest palindromic subsequence of a string?
Simple meaning
It is LCS of the string and its reverse, or interval DP: dp[i][j] = 2+dp[i+1][j-1] if s[i]==s[j] else max of shrinking either end.
Open the full page for Why, Steps, Example and Key takeaway.