#3734
Lexicographically Smallest Palindromic Permutation Greater Than Target
hard · 24.8% accepted · 39 likes · top 4%
two pointers · string · enumeration
Description
You are given two strings s and target, each of length n, consisting of lowercase English letters.
Return the lexicographically smallest string that is both a palindromic permutation of s and strictly greater than target. If no such permutation exists, return an empty string.
Solution