You are viewing a single comment's thread. Return to all comments →
Concise O(n) Python solution using slicing
def rotateLeft(d, arr): effective_d = d % len(arr) if len(arr) == 1 or effective_d == len(arr): return arr arr = arr[effective_d:] + arr[:effective_d] 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 →
Concise O(n) Python solution using slicing