Given an array of integers and a number of positions to rotate, write a program to rotate the array to the right by the given number of positions.
Input:
Output:
Example 1
Input: 5 1 2 3 4 5 2
Output: 4 5 1 2 3
The array is rotated 2 positions to the right.
Constraints
Hints
Given an array of integers and a number of positions to rotate, write a program to rotate the array to the right by the given number of positions.
Input:
Output:
Example 1
Input: 5 1 2 3 4 5 2
Output: 4 5 1 2 3
The array is rotated 2 positions to the right.
Constraints
Hints