Left Rotation :-
➤ A left rotation operation on an array of size shifts each of the array's elements unit to the left. For example, if left rotations are performed on array , then the array would become .
➤ Given an array of integers and a number, , perform left rotations on the array. Then print the updated array as a single line of space-separated integers.
➤ FOR 4 LEFT ROTATION:-
Sample Input :-
1 2 3 4 5
Sample Output :-
5 1 2 3 4
Explanation :-
When we perform left rotations, the array undergoes the following sequence of changes:-
[1,2,3,4,5]->[2,3,4,5,1]->[3,4,5,1,2]->[4,5,1,2,3]->[5,1,2,3,4]
Thus, we print the array's final state as a single line of space-separated values, which is 5 1 2 3 4
.
Solution:- https://drive.google.com/open?id=0B7snCzdq8oJDZUZCWkI1eXd5YUk
Comments
Post a Comment