#3722
Lexicographically Smallest String After Reverse
specialist · 815 · lc medium +31 · 54.7% accepted · 36 likes · top 47%
Description
Given a string s of length n, perform exactly one operation — reversing either the first k or the last k characters for some 1 <= k <= n — and return the lexicographically smallest string obtainable.
Code
1
2
3