Add solution to Exercise 3.6.