ELI5: Explain Like I'm 5

Lexicographically minimal string rotation

Okay kiddo, have you ever played with those letter blocks? You can arrange them to spell words, right? Well, imagine you have a really long word spelled out with those blocks, but instead of rearranging the blocks to make new words, you twist the entire stack of blocks all at once.

Now, when you twist them, the letters at the beginning of the word move to the back, and the letters at the back move to the front. So, you end up with a new word that starts in a different place but has all the same letters. That's called a rotation.

Now let's say you want to twist the blocks so that the new word you get is as small as possible in alphabetical order. That means you want the letters at the front of the word to be as small as possible. For example, if your original word was "banana", the smallest possible rotation would be "ananaB" because "a" is smaller than "b".

Finding this smallest possible rotation is called finding the lexicographically minimal rotation. It's like a special way of twisting those blocks to get the smallest possible new word that still has all the same letters.
Related topics others have asked about: