Longest Palindromic Subsequence

Medium · Dynamic Programming · about 20 minutes

Asked at Amazon, LinkedIn, Uber.

Delete as few characters from s as needed (keeping the rest in order) so that what remains is a palindrome. Return the length of the longest palindrome you can get this way.

Related guides