Arrays: Left Rotation

  • + 1 comment

    They have rotate built into the deque

    def array_left_rotation(a, n, k):
        a = deque(a)
        for i in range(k):
            a.rotate(-1)
        return a