# Conservation of energy or conservation of momentum- which one is applicable in this problem?

PROBLEM:

And I found its solution from this Link:
It is quite an extended solution and I am not drawing you into the entire working. You can wish to see it if you want. I just want to point out one portion in his solution where the momentum of the system is said to be conserved in the vertical direction which seemed quite illogical to me. It goes as follows:

My point is that gravitational force is acting downwards on the system or in other words an external force is acting on the system along the y-axis. Then how can momentum be conserved along y-axis as the solution says?

My answer does not match that of the solution. But I have used conservation of energy and it is obvious that energy is conserved in a gravitational field since it is conservative.

My equations go as:
At the highest point i.e. at height $H$, $$K.E._{initial} + P.E._{initial} = K.E._{final} + P.E._{final}$$ $$\frac{1}{2}mv_0^2 + mgh = 0 + (M+m)gH$$ and then I solve for $H$.

Which method do you think is correct?