problem 20 naive solution