Problem 2582 · Easy

Pass the Pillow

Simulate the pillow bouncing between the ends of the line: reverse direction at person 1 and person n.

Open the interactive visualisation