Adding the solution for the homework 1.