  We consider an inverse optimization spectral problem for the Sturm-Liouville
operator $$\mathcal{L}[q] u:=-u''+q(x)u$$ subject to the separated boundary
conditions. In the main result, we prove that this problem is related to the
existence of solutions of boundary value problems for the nonlinear equations
of the form $$-u"+q_0(x) u=\lambda u+\sigma u^3$$ with $\sigma=1$ or
$\sigma=-1$. The key outcome of this relationship is a generalized Sturm's
nodal theorem for the nonlinear boundary value problems.
