Search
⌘K

Leetcode 2697. Lexicographically Smallest Palindrome

Given a lowercase string, make the minimum number of character replacements to turn it into a palindrome and, among all such minimal-change palindromes, return the lexicographically smallest one. Key idea: handle each mirrored pair independently—when characters differ, replace them with the smaller letter.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.