My answer to Udacity's CS046 Problem Set 3, Question #3