39. Rotate Array
EasyArray
Rotate the array to the right by k steps.
Input format
Line 1: n k Line 2: n integers
Output format
The rotated array.
Example 1
Input
7 3 1 2 3 4 5 6 7
Output
5 6 7 1 2 3 4
Example 2
Input
4 2 -1 -100 3 99
Output
3 99 -1 -100
Constraints
1 ≤ n ≤ 10⁵, 0 ≤ k ≤ 10⁹
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…