add solution to third problem