1. Home
  2. Computing & Technology
  3. C / C++ / C#
photo of David Bolton
David's C / C++ / C# Blog

By David Bolton, About.com Guide to C / C++ / C#

My Mailbox is groaning, under the weight

Friday June 1, 2007
Thanks for all the entries for the Programming Challenge 1, please keep them coming- there's still 29 days to go! I've not looked at them all yet, but so far the ones I've seen just use Brute force to enumerate all the possibilities. For this challenge that will certainly work- 26 years ago when I first encountered this problem, I wrote a 6502 assembler program to brute force it and on my computer which was an 8 bit, 1Mhz 6510 (Commodore Vic-20) it took several hours. I've now rewritten it in C and on my desktop PC at work which is three years old, it finds the answer it in well under 10 seconds. Such is the increase in processing speed of computers in 26 years!

Brute force as an algorithm has its place but there are more ways to skin this cat, metaphorically speaking. I'm not a candidate for the Fields's Medal which is given every 4 years to an outstanding mathematician, but I managed to solve it with pen and paper in well under 20 minutes. Let me give you a hint: Factorials. I'll explain how next month.

Have a good weekend and keep the entries coming in. Remember you can submit source code in C, C++ or C#. I've already got next month's challenge ready for you, and if anyone has any ideas for future challenges, please email me at the usual email address cplus.guide@about.com.

Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2009 About.com, a part of The New York Times Company.

All rights reserved.