Amazon Interview Question

Asteroids moving left and right