prob2 solution