Problem 798 · Hard

Smallest Rotation with Highest Score

Use a difference array over rotations: each element scores for one cyclic range of k, found in O(1).

Open the interactive visualisation