topcoderlogoI have passively wanted to participate in programming contests for a long time. The last I was in a contest was when I was in 11th grade. We programmed in Basic on an IBM PC-AT (yes – it had a whopping 10MB hard drive!). I solved 2 out of the 3 problems. My partners mulled over a 3rd problem and I only got halfway through the 4th problem. Boy, that was a long time ago! The last 5-6 years, I’d remember about programming contests after reading some article on Slashdot, run some Google searches, come up mostly empty, and promptly forget about it. But today, while browsing through the Google Jobs website, I learnt of this thing called TopCoder Arena. That started an interesting journey, and now I’m all pumped to try out some contests. From what I see, very few people solve the toughest problem in the set, so if I practice well, I’ll definitely be able to win a few contests!
But this post is not about how to win a contest – this is simply about how to start using the excellent, free resource that is TopCoder.

TopCoder is initimidating when you start using it. There are too many options, but none of them seem like the most obvious thing to try. There is a dire lack of documentation (or the documentation is badly published – i.e., difficult to find – cuz I found none). So, for my own reference and for all those souls who would like to try out TopCoder but end up procrastinating on it due to its complexity, hope this article helps. Follow the sequential procedure below, and you are certain to get engrossed solving programming puzzles in no time.

Register

The obvious first step is to register on their website. You will receive an email to activate your account. Follow the link and activate your registration.

Arena

The most important part of TopCoder is the Arena. That is where you will be able to compile, test, and submit solutions to contest problems. You can also chat with other participants on the chat room. It looks very much like an web based IRC client, but is way more than that.

To run Arena, you will need to have the Java plugin installed on your browser. If you don’t have it, just run a search for ‘java browser plugin’, download the package and run the installer. The perferred method for running Arena is through Java Web Start. After you log in to TopCoder, click on the ‘O(n)’ icon in the top left toolbar to access Arena. When you click it, you will get a prompt to download (save) or run ContestAppletProd.jnlp (or something similar if they change the name). You can select Run.

topcoderalglink

This will start a Java app, and it will ask if you want to integrate this to your desktop. That means that you will have a shortcut from your desktop to directly jump to Arena and you won’t have to download the applet every time you want to log in to Arena.

Once you have the applet running, type in your login credentials, and it should bring you to a (arguably cluttered) landing page marked Competition Arena.

Exploring Arena

You can jump to a Practice Room from the landing page (it brings up a new window if you choose to enter a practice room). Select ‘Practice Rooms’ -> ‘SRMs’ -> some number. The numbers correspond to room numbers and in each room, there will be a set of 3 problems you can practice on. The name of the room would be something like ‘177 – SRM 233 Div 1′ . SRM refers to ‘Single Round Match’ – which means that people compete on exactly one set of (3) questions. Div 1 is the beginning level, and as you collect points from competitions, you move on to Div 2. Div 2 problems are a bit more difficult than Div 1 problems.

topcoderarena

Once in the room, you can select one of the 3 problems to work on from the aptly marked ‘Select One’ drop box. The numbers there are the number of points each problem is worth. You have to submit the solution within a very short time to get the full score, mind you! When you select an option, you will be taken to another window. The top panel in that window has the problem statement. The bottom panel is the editor window.

You will find it easiest to edit the code in your IDE on your local computer. Once you have compiled and tested the code, you can copy and paste the relevant parts into the editor, and hit the Compile button at the bottom. You should leave out any testing stub code when pasting to the editor since you may be penalized for too much unreferenced code. When you click ‘Submit’, you might get a dumb message saying your submission may have more than 30% excess code. I’ve found that it’s just some low-intelligence automatic code parser that tends to be mostly wrong. So, it’s probably safe to ignore it and submit the code. During a contest, there will be live human admins evaluating your code, so don’t let the message intimidate you.

topcoderproblemwindow

As you can see, you have a choice of writing your code in any of the following languages:

  • Java
  • C++
  • C#
  • VB

Looks like Python is in the works. I am way faster with Python than with any of the other languages (I creep with Java!). Hopefully, they will have Python by the time I try my first contest.

Going back to the Practice Room window, you can browse the submissions of other participants. This is one of the coolest features, and can really help you improve your programming. Looking at good code is by far the best way to learn good programming practices and techniques. You can browse the submissions by clicking on the ‘Summary’ button. This brings up a list of participants who have submitted a solution to the problems. You can right click on each of the problem columns and select ‘Source’ to view the source code. I have found that C++ seems to be the language of choice – so if  you are using any of the other languages, do the translation in your head.

Problem Archive

If you don’t want to submit a solution, you can still browse older problems by going into the Problem Archive. You can access it from the Home page (not the Arena window). Navigate to the TopCoder home page, locate ‘Algorithms’ in the left pane, expand into Statistics->Problem Archives. Problems are listed chronologically with the latest problem sets at the top.

Unfortunately, if you want something more advanced than just building algorithms, you will have to visit the site regularly and ‘register’ for one of the software architecture, component development, software assembly or software engineering challenges. Although they have the history of the challenges, they don’t divulge the details unless you sign a confidentiality agreement and register for the problem. But as long as you honor the confidentiality, there is no penalty for not completing the challenge. I intend to take on a higher level .NET development challenge when one comes along. Those projects last about a week. It will be a good test of development speed. I will definitely blog my experience here.

I am still exploring the site, so as I find more interesting things, I’ll keep posting.

Happy puzzle solving till then.