To solve this problem it is necessary to apply the concepts related to the conservation of kinetic and potential energy, that is to say

Where,
KE = Kinetic Energy
PE = Potential Energy (in a Spring)
Using the expression we have that

Here,
k = Spring constant
x = Displacement
m = mass
g = Gravitational acceleration
h = Height
Re-arrange to find the displacement,



Therefore the maximum distance the spring is compressed around to 0.5m