problem 24 solution