Currently going through an old question which concerns a particle of mass $m$ on the interval $[-a,a]$ with potential $V=V_0$. In the question it says to show that the energy levels of the particle are $E=V_0+\frac{n^2\pi^2\hbar^2}{8ma^2}$, but after numerous tries and checks I keep getting $E=V_0+\frac{n^2\pi^2\hbar^2}{2ma^2}$, just want to check that the answer in the question isn't just wrong so I stop wasting my time trying to figure out where I went wrong. Thank you for your help!
WORKING:
Letting $k=\frac{(2m{E-V_0)^\frac{1}{2}}}{\hbar}$, I got the only non trivial solution to the SE is $Acos(kx)+Bsin(kx)$ and using the conditions that the wave function should be 0 at the endpoints, I got $ka=n\pi$, but the answer in the question works only if $ka=\frac{n\pi}{2}$ and im not sure why this should be the case.