The Questions from Craig MacDonald's web page..
Answers:
to Question 2. A more efficient solution.
Note: None of the code in the above answers has been compiled. If something in the code doesn't make sense or has an obvious error, PLEASE email me so I can correct it. If you have a more efficient way of implementing the solution, please email it to me too.