Given a string, find the longest palindromic substring in linear time i.e. substring that is also a palindrome. Subsequently, Find all palindromic substrings of a given string
Tag Archives: longest palindrom
Longest palindrom by deleting/inserting elements
Given a string. Find minimum number of insertion (or deletions) required to make it a palindrom.
For example, S=”abacba” can be transformed into the longest palindrom P1=”abacaba” just by inserting 1 char.
Longest palindromic substring in O(n^2) time
Given a string, find the longest substring that is also a palondrom.
One simple solution is to find reverse of S and then find the longest common substring between S and reverse(s). This is also be the longest palindromic substring. That is,
LongestPalindromicSubStr(S) = LCS(S, reverse(S)).