Problem 3735 · Medium

Lexicographically Smallest String After Reverse II

Reverse one prefix or one suffix of the string and keep the smallest result.

Open the interactive visualisation