Arrays: Left Rotation

  • + 3 comments

    I agree modular arithmetic is awesome. But, simple list slicing as follows solves too ;)

    def rotLeft(a, d): return a[d:]+a[:d]