At the start of the solution, it says:

Let’s rewrite the Hamiltonian as a combination of its eigenstates

H = \sum_i E_i |E_i\rangle

I think this equation is meant to look like H |E_i\rangle = E_i|E_i\rangle, since the Hamiltonian is an operator not a state. Rest of the solution looks ok.