A simple solution to the k-core problem