Loading...
Loading...
Loading...
A rota moves every person k places to the right, and the last people wrap to the front. Rotate the list and print it.
Example
Input
5 1 2 3 4 5 2
Output
4 5 1 2 3
The last two move to the front.
Try the problem first. Open one hint at a time.
Rotating by the length changes nothing, so reduce k first.
After the reduction the answer is the last k items followed by the others.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor