Problem 3 solution
Problem 2 solution