
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
If a palindromic permutation exists, we just need to generate the first half of the string.
To generate all distinct permutations of a (half of) string, use a similar approach from: <a href="/problems/permutations-ii">Permutations II</a> or <a href="/problems/next-permutation">Next Permutation</a>.