Problem 2 naive solution