Problems > Rotate Right by K > Editorial

Rotate Right by K — Solution & Editorial

Back to the Problem

Reduce K modulo N, then output the two slices swapped (or reverse-reverse-reverse for O(1) memory).

Complexity: O(N)