Arrays: Left Rotation

  • + 1 comment

    I think there is no need of any maths or what you did. Well what i do is down below, more simple and works for all test cases.

    #a = given_array
    #d = given number of left rotations to be done
    b = []
    b.append(a[d:])
    b.append(a[:d])