It it does not contain it will be palindrome for at least one anagram. What will be the case when given String cant be palindrome Ans If it contains more than 1 odd no. Here is a simple solution that struck to my mind after the interview. Here it is s (str1,palin)) else: print (Sorry the given string s cannot be converted into a Palindrome (str1)) Reply Aayush Singhal on at 10:35 pm said: Due to this problem. ![]() This indicates that all the characters in a string must occur even number of times except for one which appears in the middle of the string. So for every character in the first half, there is a corresponding matching character in the second half. In case of odd length of strings, we have to ignore the middle character. ![]()
0 Comments
Leave a Reply. |