adding solution to question 2