Adding solution to homework 3