Solves Problem 3