ArrayTwo Pointers
Rotate the array to the right by k steps. Each step moves the last element to the front.
Input
Line 1: n and k. Line 2: n integers.
Output
Print the rotated array on one line.
Constraints
1 <= n <= 10^5 0 <= k <= 10^9 -10^9 <= each value <= 10^9
Example 1
Input
7 3 1 2 3 4 5 6 7
Output
5 6 7 1 2 3 4
The last three elements 5 6 7 move to the front.