You want to use a spring (k=100 N/m) to send a 500-g mass up a frictionless incline (30 degree to horizontal) to arrive at a platform 3m above the ground. How far should you compress the spring?

energy at top=energy of spring

mgh=1/2 k x^2

solve for x