Problems > Rotate Left by K > Editorial

Rotate Left by K — Solution & Editorial

Back to the Problem

Reduce K modulo |S| first, then concatenate the two slices.

Complexity: O(|S|)

Watch out: K can vastly exceed |S| — reduce modulo the length before slicing.