added solution for hw1 problem 6