The work is devoted to the study of the inverse problem for the Sturm-Liouville operator with a real square-integrable potential. The boundary conditions are non-separated. One of these boundary conditions includes a quadratic function of the spectral parameter. A uniqueness theorem is proved and an algorithm for solving the inverse problem is constructed. As spectral data, we use the spectrum of the considered boundary value problem, the constant term of the quadratic function of the spectral parameter included in the boundary condition, and some special sequence of signs. From these spectral data, the characteristic function of the boundary value problem is first reconstructed in the form of an infinite product and the parameters of the boundary conditions, and then the problem is reduced to the inverse problem of reconstructing the potential of the Sturm-Liouville operator from the spectra of two boundary value problems with separated boundary conditions. The results of the article can be used for solving various versions of inverse problems of spectral analysis for differential operators, as well as for integrating some nonlinear equations of mathematical physics.