Solution to the week-2 assignment