Reverse Shuffle Merge

  • + 0 comments

    The problem is that "abcdefgabcdefg" doesn't contain the reverse of "abcdefg," so the original string must be some form its reverse, "gfedcba." By rotating that sequence one letter, we get "agfedcb," which is lexicographically smallest, since "a" is the smallest letter.