Problem 798 · Hard
Use a difference array over rotations: each element scores for one cyclic range of k, found in O(1).
Open the interactive visualisation