FrontendX
Palindrome Permutation II
medium
Blind solve
Description
AI Assistance
Solution
Test Cases
Test Result
Submissions
Canvas
Palindrome Permutation
II
Given a string s, return all possible palindromes that can be formed by permuting its characters.
Examples
Example 1
Input:
"aabb"
Output:
["abba","baab"]
Example 2
Input:
"abc"
Output:
[]
Hints
Hint 1
First check if palindrome permutation is possible (at most one odd count).
Hint 2
Generate the first half, then mirror it.
Hint 3
Handle the middle character if there's an odd count.
Related Problems
24-game
additive-number
all-paths-from-source-to-target
1
/**
2
* @param {string} arg1
3
* @return {string[]}
4
*/
5
function solve(arg1) {
6
// solve Palindrome Permutation II problem here
7
return [];
8
}
Click to start editing · javascript
Palindrome Permutation II
Given a string s, return all possible palindromes that can be formed by permuting its characters.