Solution to #3-10