Particles on a string problem

Question

Hints

Answer