Index based Rotation


#1

Heres my solution . I did indexed based solution . Kindly comment and tell me does it have higher complexity than iteration based approach .

class Solution:
# @param a : list of integers
# @param b : integer
# @return a list of integers
def rotateArray(self, a, b):
    # base case :
    l = len(a)
    if b<l:
     
        return a[b:] + a[:b]
        
    else:
        b = b%l
       
        return a[b:] + a[:b]

#2
def rotateArray(self, a, b):
        b %= len(a)
        return a[b:] + a[:b]

#Python sol