A non-Euclidian space here presumably means a [Riemannian manifold](https://en.wikipedia.org/wiki/Riemannian_manifold) $(M,g)$. Let us also assume there is given some gravitational energy distribution/profile $V:M\to\mathbb{R}$. So the [brachistochrone](https://en.wikipedia.org/wiki/Brachistochrone_curve) [problem](https://mathworld.wolfram.com/BrachistochroneProblem.html) is to minimize the time 
$$\Delta t~=~\int_A^B \frac{ds}{v}~=~\int_A^B \frac{\sqrt{g_{ij}(x)dx^idx^j}}{\sqrt{\frac{2}{m}(E-V(x))}}\tag{1}$$
for a curve of a fixed constant [mechanical energy](https://en.wikipedia.org/wiki/Mechanical_energy) $E$ between 2 points A and B.

For examples, see e.g. [this](https://physics.stackexchange.com/q/7421/2451) Phys.SE post. There are generalizations to [pseudo-Riemannian manifolds](https://en.wikipedia.org/wiki/Pseudo-Riemannian_manifold), cf. e.g. [this](https://physics.stackexchange.com/q/7654/2451) Phys.SE post.