You are viewing a single comment's thread. Return to all comments →
Python Solution with minimum no of rotations remainder = minimum no. of rotations or swaps required on the arr
def rotateLeft(d, arr): n=len(arr) rem=d%n if d==0 or rem==0: return arr else: for i in range(rem): arr.append(float('-inf')) arr[0],arr[-1]=arr[-1],arr[0] arr.pop(0) return arr
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 →
Python Solution with minimum no of rotations remainder = minimum no. of rotations or swaps required on the arr