Given an array of integers and a non-negative integer k, return a new array rotated to the right by k positions.
Examples
Input:[[1,2,3,4,5,6,7],3]
Output:[5,6,7,1,2,3,4]
Input:[[-1,-100,3,99],2]
Output:[3,99,-1,-100]
Hints
Consider using a temporary array to store the rotated elements before assigning them back to the original array.
Explore the use of array reversal techniques to achieve the rotation in-place without extra space.
Investigate how to handle cases where k is larger than the array length by breaking down the rotation into multiple steps or using mathematical properties of modular arithmetic.