[Task] Add solution to the question 2

Source codes for the question 2 is finalized.