Collision of Inelastic ball above the ground 
An inelastic ball of mass $m$ is dropped from a height $h$ above the ground and at the same time a second ball of mass $m_1$ projected vertically upwards to meet the former. Show that in order that immediately after collision, the balls may be at rest, the 2nd ball must be projected with a velocity $$\sqrt{\frac{m+m_1}{m_1}gh}$$

Attempt:
Let $u\implies$ Vel with which the 2nd ball is projected.
Let $v_1, v_2\implies$ Vel of 1st and 2nd ball just before impact at a height $d$ above the ground.
Then $v_1^2=2g(h-d)$ and $v_2^2=u^2-2gd$
From the principle of conservation of linear momentum, $mv_1+m_1\times (-v_2)=0\implies mv_1=m_1v_2$
We have to find $u$. 
I am unable to get $u$ as provided in the question. Always $d$ or $v_1$ are coming in the answer and unable to eliminate. 
For details,
$mv_1=m_1v_2\implies m^2v_1^2=m_1^2v_2^2\implies m^2\times 2g(h-d)=m_1^2(u^2-2gd)$ 
$d$ is there ???. 
Please help. 
 A: Let $t$ be the time from the dropping the fist ball until the collision of the balls.  Then, $v_1=gt$ and $v_2=u-gt$.  Moreover, $d=ut-\frac{1}{2}gt^2$ and $h-d=\frac{1}{2}gt^2$, so that $ut=d+(h-d)$, which gives $t=\frac{h}{u}$.  Because $mv_1=m_1v_2$, we must have $m\left(\frac{gh}{u}\right)=m_1\left(u-\frac{gh}{u}\right)$, or
$$mgh=m_1\left(u^2-gh\right)\,.$$
The rest is your job.
A: Let the balls meet at the height $d$ from the ground then at the time of collision, the velocity of the ball (mass $m$) is given by third equation of motion as follows 
$$v^2=(0)^2+2g(h-d)$$
$$v^2=2g(h-d)\tag 1$$ & the time taken by ball (mass $m$) to reach at the point of collision is given by second equation of motion as follows 
$$h-d=(0)t+\frac{1}{2}gt^2$$
$$t=\sqrt{\frac{2(h-d)}{g}}$$ 
if the ball (mass $m_1$) is projected with the initial velocity $u$ vertically upwards then the its velocity at the time of the collision $$v_1^2=u^2-2gd\iff v_1=\sqrt{u^2-2gd}\tag 2$$
& the time taken by ball (mass $m_1$) to reach at the point of collision is given by first equation of motion as follows $$v_1=u-gt$$ setting the values of $v_1$ & time $t$ we get $$\sqrt{u^2-2gd}=u-g\sqrt{\frac{2(h-d)}{g}}\tag 3$$
Now, at the time of inelastic collision the balls will collapse to rest for a moment hence by the law of conservation of the linear momentum, we get
$$\text{momentum before collision}=\text{momentum after collision }$$
 $$mv-m_1v_1=0$$$$\iff m^2v^2=m_1^2v_1^2$$  Now, setting the values of $v^2$ & $v_1^2$, we get $$m^2(2g(h-d))=m_1^2(u^2-2gd)$$ 
$$d=\frac{2m^2gh-m_1^2u^2}{2g(m^2-m_1^2)}$$
Now, substitute the above value in (3) & solve for $u$
