Use v = u + at vertically:
0 = usin(alpha) - gt
=> t = [usin(alpha)]/g (*)
Now, use speed = Distance/time
ucos(alpha) = AB/t
Substitute in from (*) to get:
ucos(alpha) = [ABg]/(2usin(alpha)
=> AB = 2u^2sin(alpha)cos(alpha)/g
then use trig identity 2cos(alpha)sin(alpha) = sin(2alpha) to get the answer