Question
A block of massip, sliding on a smooth horizontal surface with a velocity $\vec{\text{v}}$ meets a long horizontal spring fixed at one end and having spring constant k as shown in figure. Find the maximum compression of tin spring. Will the velocity of the block be the same $\vec{\text{v}}$ when it comes back to the original position shown? 

Let the compression be x.