#2734

Lexicographically Smallest String After Substring Operation

expert · 1115 · lc medium +32 · 34.5% accepted · 279 likes · top 12%

Description

Given a lowercase string s, choose any non-empty substring and shift every character one step earlier in the alphabet ('a' wraps to 'z'). Perform this operation exactly once and return the lexicographically smallest result.

Code

1
2
3