Added solution for question 2.