Leetcode 3518. Smallest Palindromic Rearrangement II
Given a palindromic string s and integer k, return the k-th lexicographically smallest distinct palindromic permutation of s (or "" if fewer than k exist). The core challenge is to construct the palindrome by building its first half in lexicographic order while using combinatorial counts on multiset permutations (accounting for duplicate letters and a possible center char) to skip blocks without enumerating all permutations.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.