Added Problem 2's solution.