adding the submitted solution for pset3.