Java

Java Program for Left and Right Rotation of an Array2 min read

Array Rotation simply means shifting the array elements to the left or right of the array by specified positions. An array can be rotated to the left(clockwise) or to the right (anti-clockwise) to the given number of positions. Now let us look at a program for left rotation of an array and right rotation of an array.

Left Rotation of Array 

Left rotation of an array means shifting of the elements in an array towards the left as shown in the below image. Left rotation means rotating the elements of the array in a clockwise direction to the specified number of positions.




Java Code:

Output:

Leave a Comment