problem 2 and naive solution