You are viewing a single comment's thread. Return to all comments →
def rotateLeft(d, arr): return arr[d:]+arr[:d]#for left rotation
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')
first_multiple_input = input().rstrip().split() n = int(first_multiple_input[0]) d = int(first_multiple_input[1]) arr = list(map(int, input().rstrip().split())) result = rotateLeft(d, arr) fptr.write(' '.join(map(str, result))) fptr.write('\n') fptr.close() #FOR RIGHT ROTATION return arr[-d:]+arr[:-d]
#
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 →
def rotateLeft(d, arr): return arr[d:]+arr[:d]#for left rotation
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')
#