• + 0 comments

    My solution was pretty simple, after trying looping over the array without success, I tried the most simplistic approach, dividing the array and then putting it all together, as the order doesn't change I just needed to extract the portion of items where d would be the "zero" index and append to it the rest of the array. One line needed, python 3, O(n) complexity

    def rotateLeft(d, arr):
     return arr[d:]+arr[:d]