Problem 4043 · Medium

Count Rotations With Exactly K Equal Adjacent Pairs

Move each prefix to the end of the string and count the rotations whose linear text has exactly k equal neighbouring pairs.

Open the interactive visualisation