Wednesday, October 27, 2004

Topcoder Challenge 217

I participated in the Topcoder Challenge tonight. In case you don't know what that is, it's a competition where a bunch of programmers get together in an "arena", are given three problem statements of varying difficulty, and must develop a solution for each problem that provides the correct output for a given input.

I don't think I'm allowed to discuss the problem statements here, so you'll have to visit the site, load up the competition arena program, and view the practice rooms (which have problem statements from past competitions). You'll need to create a user ID on the site.

Anyways, I've always considered myself a good programmer with good problem solving abilities and who brings innovation to my job. Let me tell you, there's nothing like going head to head with fellow geeks under a 1 hour (or so) time limit to make you humble (there are a lot of talented folks out there, and what's pathetic for me is that I bet a bunch of them are under the age of 16!).

In the past, I've usually screwed up with really minor mistakes. They use an automated test procedure to feed your program input and check the output to see if it's what's expected. If any test fails, you get no points for it. Otherwise, your points are based on the difficulty of the problem minus some factor for how long it took you to code it. If you're fast, you get more of the original point value (so the problem might be a 500-point problem, and if it takes you 10 minutes to write the program, you might end up with 350 points).

Tonight, I managed to submit solutions to 2 of the 3 given problems (then I ran out of time). The cool thing about this competition is that you can look at other people's solutions when it's over, and see how it could be done better/faster.

I spent the most time on the hardest problem tonight, and my solution involved some trigonometry to calculate lengths of sides of triangles. Looking at other (better) programmer's solutions, I see that my trig calculations were totally unnecessary because a simple iterative comparison worked just as well for what the problem was asking.

This is a great way for a coder to hone their skills (working in business consulting doesn't let you fully exercise your mind like the Topcoder Challenge does).