Practice Smallest Palindromic Rearrangement II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Smallest Palindromic Rearrangement II
Problem Statement
You are given a palindromic string s and an integer k. Return the k-th lexicographically smallest palindromic permutation of s. If there are fewer than k distinct palindromic permutations, return an empty string. Note: Different rearrangements that yield the same palindromic string are considered identical and are counted once.
Source: Smallest Palindromic Rearrangement II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "abba", k = 2
"baab"
# Example 2
s = "aa", k = 2
""
# Example 3
s = "bacab", k = 1
"abcba"
Constraints
Related LeetCode Problems
Practice more problems similar to Smallest Palindromic Rearrangement II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.