Let $L = \frac{1}{\sqrt{2gu}} \sqrt{1+u^{\prime\,2}}$. Hamiltonian $H=u' L_{u'}-L=constant$ implies
\begin{equation} u' = \sqrt{\frac{2A-u}{u}} \label{u} \end{equation} for some constant $A$. Reparameterize $u = A - A\cos\theta$ to obtain the solution to ($\ref{u}$).
\begin{equation} x = A (\theta - \sin \theta) + C \end{equation}
Condition $u(0)=0$ implies that $C=0$. The solution is a parametric cycloid:
\begin{equation} x = A (\theta - \sin \theta) \end{equation}
\begin{equation} u = A (1 - \cos \theta) \end{equation}