The only thing which we care about is the number of all the letters from a to z. If the string has an even length then we need to have even number of letters of each type so that we can form a palindrome. If the initial string has an odd length, then we need to have exactly one letter repeating odd number of times and the other letters repeating even number of times.
No comments:
Post a Comment