Solution to the assignment 2