+ 1
Find the minimum string required to add in a string to make it palindrome
can any one have solution of this problem ex- input- ababc o/p - no. of character added 4 baba
3 Réponses
0
Get a substring of the input, up to the last character. Reverse this substring.
string MakePalindrone(string str)
{
string sub = str.SubString(0, str.length-1);
// I don't remember if the Reverse method operates in place
string reversed = sub.Reverse();
return str+reversed;
}
0
thnks John. I also crack the code using for loop withut reversing the string