problem6 start
naive solution + optimal solution