+ 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

30th Jul 2018, 2:24 PM
saquib jack
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; }
30th Jul 2018, 6:14 PM
John
John - avatar
0
thnks John. I also crack the code using for loop withut reversing the string
30th Jul 2018, 6:37 PM
saquib jack
30th Jul 2018, 6:51 PM
saquib jack