Add solution to Problem 2