This problem as stated is incomplete. The differential operator is not completely defined unless some boundary conditions are specified. If the boundary condition says that y→∞ as x→∞ then you are correct to take functions of the form A*exp(n*x) as eigenfunctions. More often, the boundary conditions will say for example y=0 when x = 0 and when x = π. In that case, the eigenfunctions will be of the form A*sin(nx) and the eigenvalues will be k–n^2 (still not equal to the given solution n^2–k, but perhaps you are using a different convention about signs).