Write a program to rotate an array to the right by a given number of positions.
HardProblem Statement
Write a program to rotate an array to the right by a given number of positions.
Sample Input
int arr[] = {1, 2, 3, 4, 5}; int k = 2;Sample Output
Rotated array: 4 5 1 2 3
Limits
Time: 2s · Memory: 256 MB