added solution for hw2 problem 2f