# Given an array, rotate the array to the right by k steps, where k is non-negative.
#
# Example 1:
#
# Input: [1,2,3,4,5,6,7] and k = 3
# Output: [5,6,7,1,2,3,4]
# Explanation:
# rotate 1 steps to the right: [7,1,2,3,4,5,6]
# rotate 2 steps to the right: [6,7,1,2,3,4,5]
# rotate 3 steps to the right: [5,6,7,1,2,3,4]

def rotateList(nums, k):
    retList = [None for num in nums]
    for index in range(len(nums)):
        retList[(index + k) % len(nums)] = nums[index]

    return retList

nums = [1,2,3,4,5,6,7]
k = 3
retList = rotateList(nums, k)
print(retList)
8614ba92189ce773c2c46f7404e67fe7a0123632
<mask token>

def rotateList(nums, k):
    retList = [None for num in nums]
    for index in range(len(nums)):
        retList[(index + k) % len(nums)] = nums[index]
    return retList


<mask token>

def rotateList(nums, k):
    retList = [None for num in nums]
    for index in range(len(nums)):
        retList[(index + k) % len(nums)] = nums[index]
    return retList


<mask token>
print(retList)

def rotateList(nums, k):
    retList = [None for num in nums]
    for index in range(len(nums)):
        retList[(index + k) % len(nums)] = nums[index]
    return retList


nums = [1, 2, 3, 4, 5, 6, 7]
k = 3
retList = rotateList(nums, k)
print(retList)

# Given an array, rotate the array to the right by k steps, where k is non-negative.
#
# Example 1:
#
# Input: [1,2,3,4,5,6,7] and k = 3
# Output: [5,6,7,1,2,3,4]
# Explanation:
# rotate 1 steps to the right: [7,1,2,3,4,5,6]
# rotate 2 steps to the right: [6,7,1,2,3,4,5]
# rotate 3 steps to the right: [5,6,7,1,2,3,4]

def rotateList(nums, k):
    retList = [None for num in nums]
    for index in range(len(nums)):
        retList[(index + k) % len(nums)] = nums[index]

    return retList

nums = [1,2,3,4,5,6,7]
k = 3
retList = rotateList(nums, k)
print(retList)