You are viewing a single comment's thread. Return to all comments →
Keep in mind a left rotation of x is equal to (len-x) of righ rotations. Hence, it would be more efficient to the rotation with least amount of "moves".
Thats true. I got accepted for test case 8 using right rotation. We need to choose :
If #rotations < (size /2) Use Left Rotation
If #rotations > (size /2) Use Right Rotation
can you elaborate @crystalcode