3088. Make String Anti-palindrome
We call a string
s
of even lengthn
an anti-palindrome if for each index0 <= i < n
,s[i] != s[n - i - 1]
.Given a string
s
, your task is to makes
an anti-palindrome by doing any number of operations (including zero).In one operation, you can select two characters from
s
and swap them.Return the resulting string. If multiple strings meet the conditions, return the lexicographically smallest one. If it can’t be made into an anti-palindrome, return
"-1"
.
1 | class Solution { |