Assignment2 solution