Created
October 23, 2016 18:24
-
-
Save SahilKadam/1f719d5234062d41cdfa8608221538fb to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
firstLine = [int(i) for i in input().strip().split(" ")] | |
secondLine = [int (j) for j in input().strip().split(" ")] | |
n = firstLine[1]%firstLine[0] | |
secondLine += secondLine[0:n] | |
secondLine = secondLine[n:] | |
[print (i, end = " ") for i in secondLine] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment