Answer
a) $t = \pi \sqrt{\frac{m}{k}}$
b) $ x=v\sqrt{\frac{m}{k}}$
Work Step by Step
a) We know that the period is given by:
$T = 2\pi \sqrt{\frac{m}{k}}$
We know that the time in contact is half of a period, so we obtain:
$t = \pi \sqrt{\frac{m}{k}}$
b) We now find the spring's maximum compression. We know that at this point, all of the original kinetic energy will be spring energy. Thus, we find:
$ \frac{1}{2}mv^2=\frac{1}{2}kx^2\\ mv^2=kx^2\\x = v\sqrt{\frac{m}{k}}$