• + 3 comments

    Modular arithmetic is the best way to do this problem. No need to actually rotate the array. Take a look here. Circular Array Rotation