Answer:

Step-by-step explanation:
Let assume that spring reaches its maximum compression at a height of zero. The system is modelled after the Principle of Energy Conservation and the Work-Energy Theorem:



The spring constant is cleared in the expression described above:
