• + 2 comments

    Instead of rotating each element we can just cut the string upto that index and paste(append) it at the end of the string.

    A solution for python would be

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