Practice Lexicographically Smallest Palindrome
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a string s consisting of lowercase English letters, and you are allowed to perform operations on it. In one operation, you can replace a character in s with another lowercase English letter. Your task is to make s a palindrome with the minimum number of operations possible. If there are multiple palindromes that can be made using the minimum number of operations, make the lexicographically smallest one. A string a is lexicographically smaller than a string b (of the same length) if in the first position where a and b differ, string a has a letter that appears earlier in the alphabet than the corresponding letter in b. Return the resulting palindrome string.
Source: Lexicographically Smallest Palindrome on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "egcfe"
"efcfe"
# Example 2
s = "abcd"
"abba"
# Example 3
s = "seven"
"neven"
Constraints
Related LeetCode Problems
Practice more problems similar to Lexicographically Smallest Palindrome.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.