The given situation of entire motion of ball is shown in the following figure.
Initial speed of ball, u=20m∕s Total time taken by the ball to reach at highest point P is t1, then from equation of vertical motion v=u−gt⇒0=20−10t1⇒t1=2s Maximum height attained by the ball is h, then from equation h=ut−
1
2
gt2=20×2−
1
2
×10×22=40−20=20m t2 be the time taken by the ball to reach at B from point P, then h−5=0×t2+
1
2
gt22⇒20−5=0+
1
2
×10t22 15=5t22⇒t2=√3s ∴ Time taken by the ball during entire trip, t=t1+t2=2+√3s