Problem 3

Solution for the third problem