can someone show me how to deal with this problem? Thank you
A mass $m$ moves on a smooth horizontal plane with constant velocity $v$ directed parallel to the plane. At a certain instant it comes into contact with the free end of a horizontal spring, of elastic constant $K$. Considering the other end of the spring locked to a fixed support, determine:
- The duration of the interaction between the spring and the mass $m$

When in contact with the spring the movement is described by
$$ m\ddot x = -K x \Rightarrow \dot x\ddot x + \frac{K}{m} x\dot x = 0 \Rightarrow \dot x^2 + \frac{K}{m} x^2 = C $$
Now supposing enough length in the spring, by energy conservation we have
$$ \frac{1}{2}m v^2 = \frac{1}{2} K (\Delta x)^2 $$
with $\Delta x$ the maximum spring recoil.
then
$$ v^2 + \frac{K}{m}0= C\Rightarrow \dot x^2 + \frac{K}{m} x^2 = \frac{K}{m}(\Delta x)^2 $$
and then
$$ \Delta x\sqrt{ \frac{K}{m} }dt = \frac{dx}{\sqrt{1-\left(\frac{x}{\Delta x}\right)^2}} $$
hence
$$ \Delta x\sqrt \frac{K}{m}\Delta t = \int_0^{\Delta x}\frac{dx}{\sqrt{1-\left(\frac{x}{\Delta x}\right)^2}} = \frac{1}{2}\pi\Delta x $$
and finally
$$ \Delta t = \frac{\pi}{2\sqrt{ \frac{K}{m}}} $$
but the total contact time is
$$ 2\Delta t = \displaystyle{\frac{\pi}{\sqrt{\frac{K}{m}}}} $$