Answer
$0.3m$
Work Step by Step
The maximum compression of the spring can be determined as:
According to the law of conservation of momentum
$m_av_{a,1}+m_bv_{b,1}=(m_a+m_b) v$
$\implies v=\frac{m_av_{a,1}+m_bv_{b,1}}{m_a+m_b}$
$\implies v=\frac{0+10(15)}{15+10}=6m/s$
Now according to the law of conservation of energy
$\frac{Ks^2}{2}=\frac{(m_a+m_b) v^2}{2}$
$\implies s^2=\frac{(m_a+m_b) v^2}{K}$
We plug in the known values to obtain:
$s^2=\frac{(15+10)36}{10000}$
$s^2=0.09m^2$
$\implies s=0.3m$