In python, Time complexity : O(constant)


#1

class Solution:

def rotateArray(self, a, b):
    ret = []
    if b>0:
        b=b%len(a) 
    ret.extend(a[b:len(a)])
    ret.extend(a[0:b])
    return ret