Reorder to Form a Palindrome

Hard
string hash-map palindrome frequency
Problem Description

Given a string, determine if its characters can be rearranged to form a palindrome. A palindrome reads the same forwards and backwards.

Input Format
A single string containing lowercase letters.
Output Format
Return "true" if characters can be rearranged to form a palindrome, "false" otherwise.
Constraints
• 1 ≤ string length ≤ 10^5
• String contains only lowercase English letters
• Case-sensitive comparison
• Consider character frequency for palindrome formation
Sample Input/Output
Input:
aabbcc
Output:
true
Explanation

The string "aabbcc" can be rearranged to form palindromes like "abccba" or "bacbca". For a palindrome, at most one character can have an odd frequency (for the middle character).

Solution Hints
100
Points
2000ms
Time Limit
128MB
Memory Limit
Code Editor
Register to Submit
Register to Access Code Editor

Create a free account to solve coding problems and track your progress.

Register Now
Feedback