Add solution to Problem 3