Lorenzo B. answered 12/08/23
If you choose the zero level for the gravitational energy as the initial position of the block right before and after the collision; then you'd have only kinetic energy after the collision, which goes into gravitational energy as the block reaches its maximum height h. So, you'd have 1/2 M v^2 = M g h, which you would solve for h.
Your approach also works. Ui + Ki = Uf + Kf, so ΔK + ΔU = 0.
ΔU = Mgh - 0 = Mgh;
ΔK = 0 - 1/2 Mv^2 (because the block is at reach at its maximum height).
So you'd have Mgh - 1/2Mv^2 = 0, which gives us again a positive maximum height.