Answer
Please see the work below.
Work Step by Step
We know that
$x=\frac{v_{\circ}^2}{g} sin (2\theta)$
After differentiating, we obtain:
$x^{\prime}=(\frac{v_{\circ}^2}{g})(-2cos(2\theta))$
as $x^{\prime}=0$
$\implies cos(2\theta)=0$
$2\theta=90$
$\theta=45^{\circ}$