Rotate by 2
Input
rotate_queue([1,2,3,4,5], 2)
Output
[3, 4, 5, 1, 2]
Two left rotations move 1 and 2 to the back in order.
Full lesson preview
Rotate the elements of a queue (list) by N steps to the left.
Problem statement
Task
Examples
Input
rotate_queue([1,2,3,4,5], 2)
Output
[3, 4, 5, 1, 2]
Two left rotations move 1 and 2 to the back in order.
Input format
Output format
Constraints
Samples
Input
rotate_queue([1,2,3], 4)
Output
[2, 3, 1]
4 mod 3 = 1 left rotation -> [2,3,1].