Palindrome Permutations

easy
Unit 2 · Strings II0/3 to milestone

Can the letters of a phrase be rearranged into a palindrome? Ignore case, spaces and punctuation, counting only letters and digits.

A palindrome needs every character to appear an even number of times, except at most one (the middle).

Implement can_form_palindrome(s) and build_palindrome(s), which returns one palindrome using all the counted characters (lowercased), or None if impossible. Build it deterministically: the left half uses characters in alphabetical order, then the odd character (if any), then the mirror.

#strings#counting2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Palindrome Permutations · TechGradify