Problem 2

Solution for the second problem