  Within the framework of exact diagonalization (ED), we compute the ground
state of Anderson impurity problem using the variational approach based on the
configuration interaction (CI) expansion. We demonstrate that an accurate
ground state can be obtained by iteratively diagonalizing a matrix with the
dimension that is less than 10$%$ of the full Hamiltonian. The efficiency of
the CI expansion for different problems is analyzed. By way of example, we
apply this method to the single-site dynamical mean field theory using ED as
the impurity solver. Specifically, to demonstrate the usefulness of this
approach, we solve the attractive Hubbard model in the grand-canonical
ensemble, where the s-wave superconducting solution is explicitly obtained.
