Medium Accuracy: 63.83%
Submissions: 3804 Points: 4
Given a string, find the minimum number of characters to be inserted to convert it to palindrome.
ab: Number of insertions required is 1. bab or aba
aa: Number of insertions required is 0. aa
abcd: Number of insertions required is 3. dcbabcd
Here we can append 3 characters in the
beginning,and the resultant string will
be a palindrome ("dcbabcd").
Given string is already a pallindrome hence
no insertions are required.
You don't need to read input or print anything. Your task is to complete the function findMinInsertions() which takes string Sas input parameters and returns minimimum numser of insertions required.
Expected Time Complexity: O(|S|2) Expected Auxiliary Space: O(|S|2)