< Ace Coding /> 🚀
Question: Can You Make This String a Palindrome?
A palindrome is a string that reads the same forwards and backwards. Given a string, determine if it's possible to rearrange the characters to form a palindrome.
Examples:
1. Input: "civic"
• Output: True
• Explanation: The string is already a palindrome.
2. Input: "ivicc"
• Output: True
• Explanation: Rearranging the characters can form the palindrome "civic".
3. Input: "hello"
• Output: False
• Explanation: No rearrangement can form a palindrome.
4. Input: "aabbcc"
• Output: True
• Explanation: Rearranging the characters can form the palindrome "abcba".
5. Input: "racecar"
• Output: True
• Explanation: The string is already a palindrome.
Challenge:
Write a function that takes a string as input and returns True if the string can be rearranged to form a palindrome, and False otherwise.
2 · 342 ·