problem2 solution --needs optimization