Let us take that the pendulum is at rest initially and after the collision the velocity of the system is V . Now from the conservation of momentum we have ,
Initial Momentum = Final Momentum
Now let us take that the block rises to maximum height h.
So, P. E of the combination = K. E of the combination