Minimum Deletions in a String to make it a Palindrome
Let's solve the Minimum Deletions in a String to make it a Palindrome problem using Dynamic Programming.
Statement
You are given a string s
. The task is to count the minimum deletions from s
such that the resultant string is a palindrome.
Let’s take an example string, “radear”. We can remove the character “e” from this string and we will be left with “radar”, which is a valid palindrome. So, we need minimum of one deletion to make this string a valid palindrome.
Constraints:
s
contains all lowercase characters.-
s.length
Examples
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.