Solution to assignment2