Problem 4044 · Medium

Count Good Cyclic Rotations

Slide a half-length window around the ring; each shift is good when the window holds more than the rest.

Open the interactive visualisation