You are viewing a single comment's thread. Return to all comments →
you can do it without another list here is the solution...
if name == 'main': nd = input().split() n = int(nd[0]) d = int(nd[1]) a = list(map(int, input().rstrip().split())) r = d % n print(*(a[r:]+a[:r]))
Seems like cookies are disabled on this browser, please enable them to open this website
Left Rotation
You are viewing a single comment's thread. Return to all comments →
you can do it without another list here is the solution...
if name == 'main': nd = input().split() n = int(nd[0]) d = int(nd[1]) a = list(map(int, input().rstrip().split())) r = d % n print(*(a[r:]+a[:r]))