26 January 2011
Facebook Hacker Cup 2011

Over the last couple of weeks, I've been taking part in the inaugural Facebook Hacker Cup, a programming competition ran along almost identical lines to Google's well established CodeJam.

The format of the competition is quite simple.  To start with, there was a qualification round lasting 72 hours in which 3 problems were posted.  Competitors had to solve at least one of the three puzzles correctly during that time to progress to round 1.

Each puzzle consists of a problem description, including definitions of an input file you will be given, and an output file which you must upload along with your source code.  Then, there are trivial sample inputs and outputs given to test your program.  When you are happy with your program, you download the real input file, which starts a six minute timer.  You must run your program against this input, and then upload the source code of your program and your generated output file within the six minutes.

Round 1 takes place over three sub-rounds.  Each of the sub-rounds lasts three hours and again contains three challenges. The top 1000 competitors in each sub-round go through to round 2, and are ineligible to take place in further sub-rounds of round 1.  Ranking is based firstly upon the number of correctly solved problems, and secondly by the time taken to solve them.

I’m not certain whether my preferred language (C#) is acceptable.  As source code must be submitted, it could be important, but I can’t find a list of acceptable languages.  Therefore, I’ve played safe, and have written my solutions in C++, which has been a steep learning curve for me, and has resulted in my really struggling to complete within the three hour limit.

Despite the challenges of using C++, I'm delighted to say that I managed to qualify from round 1B, and am looking forward to taking part in round 2 on 5th February, which will be a single three hour session in which the top 300 competitors will receive a T-shirt, and the top 25 will be flown to Palo Alto for the onsite final.  I of course, have no expectation of getting to the final.  I'm just not good enough!

What has been a little unusual about the competition are the bugs in the Hacker Cup website. Facebook made some mistakes.  Examples were people not being able to upload their solutions properly, some serious cross-browser support issues, and in one case, an entire problem being pulled mid-session because of errors in the problem.  Because of this, the first attempt at round 1 was cancelled, and rescheduled.  Facebook have addressed the problems well, and went through a public test of the interface between the cancelled round 1 and the re-run.

What has been even more unusual, has been the comments on the wall for the Hacker Cup by other competitors.  Yes, there have been cases when criticism of Facebook was justified, particularly by those who thought they had qualified from the original round 1 before it was rescheduled.  But what I'm seeing is a constant whining and complaining from people, who, quite frankly, are not being successful because they're not good enough.

The following are some of the comments I've seen in the rescheduled round 1, which worked perfectly well:

Please run your solution verification algorithm again but ignore letter casing! Almost guaranteed that a few more people will pass (I definitely will).

Well, perhaps this poster should have read the output specification which mandated that a string reading "Wrong machine" was output in certain cases. The specification didn't say "Wrong Machine" or "wrong machine", or indeed "WrOnG mAcHiNe".

When I click my source I see the output file.

I saw many variants of this.  It's not rocket science to work out that the poster has submitted their output as their source code, and their source code as the output, resulting in their submission being marked as incorrect.  Follow the simple on screen instructions!

top 10 people finished all 3 in 30 minutes....even If I need to copy paste chess program it will take 30 mins..not sure but something is fishy

This poster can’t seem to accept that other competitors could be significantly better than him.  A quick look at CodeJam or TopCoder shows people regularly finishing this kind of challenge in these timescales.  Nothing fishy at all! (The reference to chess is that problem two in round 1B was based upon a chessboard).

Is there 6 min time limit?

Yes, RTFM.

I read how the input file would be because FB might be tricky. Then all of a sudden everything is on new lines, wish that had of been in the problem defintion. whats this, like the 5th round, and you still cant get your shit together.. Good job FB.

The specification actually reads “items separated by whitespace”.  Just because a trivial example input shown on the page uses spaces, this does not mean that the real input file downloaded will… it could contain tabs, spaces, newlines, or any combination.  An important part of software development is coding the right solution – being able to correctly interpret the problem statement is of paramount importance.

Maybe I’m being unkind, and the vast majority of competitors silently get on with it and can follow the instructions.

I wonder whether the wall posts in round 2 will be of a better standard, given that competitors will have had to get past round 1 first (although they’ve had to get past the qualification round to get to round 1).  I wonder whether because the qualification round lasted 72 hours, a lot of competitors Googled for the answers and plagiarised.  The three hour timescale of round 1 doesn’t allow for that kind of cheating.