• + 2 comments

    you could use k=k%n, what if the k is doulble or trible the size of n. subtraction always reduce one rotation.

    Consider if k = 3n => k = 3n -n => k = 2n. but in case of modular it reduces to n rotation. k = 3n => k = 3n%n => k = 0.