A block A of mass M moving with speed u collides elastically with block B of mass m which is connected to block C of mass m with a spring.
When the compression in spring is maximum, the velocity of block C with respect to block A is
(Neglect the friction everywhere)
Here, and
Velocity of C at maximum compression, vc = vB/2