← All problemsSign in

Min-Max Rotations

CodeChefRating 2810Open on judge ↗

Shamili has an array $A = [A_0, A_1, \dots, A_{N-1}]$ of length $N$. She painted each element of this array in either Black or White. She allows you to right rotate the values in array $A$ by any value $k$. In other words, let $B$ be the resulting array after right rotating $A$ by $k$, then $B_i = A_{(i-k+n) \pmod{N}}$ where $B_0$ and $A_0$ are the first elements in the arrays $A$ and $B$ respec

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start