All surfaces shown in fig are smooth .System is released with the spring unstretched.In equilbrium ,compression in the spring will be:
( nothing is fixed in the ques except spring which is fixed from wall)
Plz do it with energy conservation coz i am not able to do it with energy conservation
answer is (mg/k)
this answer is 100% correct u can check it by solving this ques from newton's laws
fig is below
plz click on fig & open it then u will see clear picture here it is not clear