Smallest Palindromic Rearrangement II

Solution Code

Time Complexity

O(n σ (σ + min(n, log k))

Space Complexity

O(σ) or O(n)