Added solution to the third problem