added very non performant problem 2 solution