Answer
The maximum distance that the spring stretches is 2d.
Work Step by Step
We can find the force constant of the spring.
$kd = mg$
$k = \frac{mg}{d}$
We can use the spring constant to find the maximum distance $y$ that the spring stretches.
$U_s = U_g$
$\frac{1}{2}ky^2 = mgy$
$\frac{1}{2}(\frac{mg}{d})y^2 = mgy$
$y = 2d$
The maximum distance that the spring stretches is 2d.