Skip to content

Latest commit

 

History

History
81 lines (34 loc) · 1.18 KB

File metadata and controls

81 lines (34 loc) · 1.18 KB

中文文档

Description

Given a palindromic string palindrome, replace exactly one character by any lowercase English letter so that the string becomes the lexicographically smallest possible string that isn't a palindrome.

After doing so, return the final string.  If there is no way to do so, return the empty string.

 

Example 1:

Input: palindrome = "abccba"

Output: "aaccba"

Example 2:

Input: palindrome = "a"

Output: ""

 

Constraints:

    <li><code>1 &lt;= palindrome.length &lt;= 1000</code></li>
    
    <li><code>palindrome</code>&nbsp;consists of only lowercase English letters.</li>
    

Solutions

Python3

Java

...