#C2837. Rotate List to the Right
Rotate List to the Right
Rotate List to the Right
You are given an array of integers and a non-negative integer x. Your task is to rotate the array to the right by x positions.
For example, if the array is [1, 2, 3, 4, 5, 6] and x = 2, the rotated array becomes [5, 6, 1, 2, 3, 4].
You need to handle multiple test cases, reading input from standard input (stdin) and writing output to standard output (stdout).
inputFormat
The first line contains an integer T, the number of test cases.
For each test case:
- The first line contains an integer N, the number of elements in the array.
- The second line contains N space-separated integers representing the array.
- The third line contains an integer x, the number of positions to rotate the array to the right.
outputFormat
For each test case, output a single line containing the rotated array as space-separated integers. A trailing space at the end of the line is acceptable.
## sample1
6
1 2 3 4 5 6
2
5 6 1 2 3 4
</p>