Problem 42 Solution.