def rototate_array2(nums, k):
    """
     This is an alternative solution using and extra array and recopying everything at the end.
     We use the modulo to move element to the end
    """

    n = len(nums)
    temp = [0] * n
    for i in range(n):
        temp[(i+k) % n] = nums[i]
    nums[:] = temp
    return nums