Google Code Jam 2016 Qualification Round: Passed

Google Code Jam is an algorithmic competition held each year by Google. The participation does not cost anything so I decided to test myself and have some practice. In this post, I will talk about my experience and my results.

The qualification round lasts 27 hours to let people from different time zones participate. There are four problems, each of which has two inputs, a small one and a big one. Generally, the small input does not require any sophisticated algorithm at this level, only a thorough understanding of the problem and good coding skills. The big input is more challenging and can require some non-trivial optimizations.

In order to pass to Round 1 you need 30 points. You know immediately if a small input you submit is correct. As for the big inputs, you don’t know if they are correct till the end of the round. This means that to have the certainty to pass during the competition, you need to solve the last 3 small inputs (10 points each, the first small input was only 7 points).

The round was held on April 10, and when I woke up it was already started for a while. I used IntelliJ IDEA for writing the code and a some sheets of paper to doodle around. The main advantage of the IDE is that you can write unit tests to save some mental energy to run easy but tricky code paths.

That morning I was quite groggy and took it really easy. I solved the first problem to warm up, it took longer than expected. This was only 7 points during the competition, even if I submitted also a correct big input (15 points in total). Strategically, solving this problem was irrelevant but still a good warm up to enter in the mood. I moved on to the second problem after some serious coffee. Solved, 17 points and submitted also the big input (which was correct).

After lunch I tackled the third problem. The small input was correct but it looked it was taking too much to solve the big input. I could have investigated and optimized it but at this point I knew that only solving the last small input would have given me the certainty to pass. Plus I had other stuff to do, so I moved on, after some more coffee.

The last problem turned out to be super easy on the small input. Probably my solution won’t work on the big input but at this time I was already done and heading towards the rest of to-do list.

I’m satisfied with my result although I don’t know if I’ll have time to continue. In particular, the next round is split in three subrounds and you need to pass at least one of them. The very next week this subrounds is at night in my timezone, so I won’t make it. The next two subrounds are at some nicer times but I’ll be rather busy so we will see.

I found it a good exercise and think every programmer should train these skills, at least to ace interviews. I have in mind to make a video where I solve live some algorithmic challenge that I haven’t solved before. Let me know in the comments if you are interested. In the meantime, here is my score (position 7254 out of 27170).