Problem Brief
Lexicographically Smallest Palindrome Possible π
OA
See Amazon online assessment and hiring insights
Given a String, return the lexicographically smallest palindrome possible or -1.
1Example 1
Input
s = "a?rt???"
Output
"aartraa"
Explanation
Question marks can be replaced by a, r, a, a and we can make it palindrome.
2Example 2
Input
s = "bx??tm"
Output
"-1"
Explanation
No character can be added to make it a palindrome.
3Example 3
Input
s = "ai?a??u"
Output
"aaiuiaa"
Explanation
'?' is replaced by a, a and i and characters are rearranged to make it a palindrome.
Constraints
Limits and guarantees your solution can rely on.
A mysterious untelling for now π§ As always, will add once find out