We know that the height of the projectile is given by:
y=usin θ t−12 gt2
This equation can be rewritten for a particular height y1 as:
gt2−2u sin θ t+2y1=0
The solution for the same would be given by:
t=u sin θ±√u2sin2 θ−2gy1g
Thus, the sum of these two times gives the time of flight, i.e., 2u sin θg