Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n, d = map(int, input().split()) # n = len(array), d = Number of rotation
- values = [i for i in input().split()][:n]
- print(" ".join(values[d:] + values[:d])) # left rotation
- print(" ".join(values[n-d:] + values[:n-d])) # right rotation
Add Comment
Please, Sign In to add comment