A while back Carlos Bueno from our site performance team wrote an excellent post about how to prepare for a technical interview at Facebook. It’s a great overview of what to expect and provides some good tips on how to get ready, but I’d like to do a deep dive into one particular aspect of technical interview prep — the bit where we try to figure out how adept you are at coding.

Usually this part of the interview boils down to writing code on a whiteboard while being thrown an occasional curve ball, like “OK, now can you think of another way to solve the problem that uses a constant amount of memory?”

Being successful at technical interviews is a skill that can be practiced. I’m going to focus on one particular way to do so: the programming contest.

Here are some of the reasons I think programming contests are an effective preparation tool:

I frequently see candidates who can describe how they want to solve a problem, but struggle when they try to express their ideas in code. Programming contests give you practice decomposing problems into algorithms and then turning those algorithms into working code. This experience is invaluable.

You’ll learn how to critically analyze your work. Because you don’t get credit for solving a problem until the code you write can generate the correct results for a large input set (and you don’t know what that input set looks like), you’re forced to think about things such as time complexity, memory usage, and nasty corner cases. Importantly, most of this work happens outside the context of a debugger. Debuggers are invaluable tools for figuring out why a given piece of code is buggy, but it’s better if you can write bug-free code in the first place. In an interview situation, candidates who can’t statically analyze their code generally have trouble showing their solution is correct (or figuring out why it’s not).

In general, you’ll become a faster and more confident programmer. This last bit isn’t specific to programming contests – it’s just a natural result of spending a bunch of time practicing the art of programming.

If that weren’t enough, it turns out that many technical interview questions are interchangeable with the types of questions that show up in programming contests. Part of the skill in such contests is learning how to map a previously unseen problem to a known set of techniques, oftentimes with a novel twist. In many ways, programming contests are direct practice for technical interviews.

Is this for me?

If you’re still in school, I’d highly recommend getting involved in programming contests as a way to further develop your skills and increase your odds of landing the job you want after you graduate. For me, discovering programming contests in college gave me an opportunity to get a bunch of coding practice, made my algorithms classes a lot more enjoyable, and helped me land my first internship at Microsoft. For a friend who was studying physics, it’s the reason he’s now working as a software engineer.

For those who’ve already started their careers and are thinking of switching companies, I’d suggest programming contests as a tool to sharpen your skills before your interviews and make sure your qualifications aren’t overlooked. Before interviewing with Facebook, I spent the greater part of two weekends solving problems from a variety of domains. I definitely felt more confident during my interviews as a result of this practice.

Where do I start?

Topcoder is a good resource for diving right in – they host weekly contests (including a rating system that allows you to track your progress) and keep an archive of past contests that you can work through on your own time.

If you don’t fancy the idea of competing in a live contest, there are also some good online problem archives. The Sphere Online Judge maintains a huge problem set that lets you submit your code to an automated judge, allows you to write your solutions in over 40 different languages, and runs a forum where you can discuss problems with other users.

If you’re still in school, the gold standard for programming contests is probably the International Collegiate Programming Contest (ICPC) run by the Association for Computing Machinery (ACM). Every year the ICPC hosts regional contests around the world, and then sends the winners of all the regional contests to their world finals. If you’re lucky enough to attend a college with an ICPC club that hosts regular practice contests, consider joining. Or if your school doesn’t have such a club, maybe you can start one.

You also might want to check out Facebook’s very own programming competition, the Hacker Cup. The top 25 finalists get flown out to our Menlo Park campus to compete in the finals, and the winner gets $10k. Not a bad way to brush up on your algorithm skills!

And for anyone who’s looking for an introduction to (or a refresher on) the fundamentals before jumping in, you might consider taking a peek at course notes from CS490 at the University of British Columbia. They essentially provide a crib sheet on the various algorithms and concepts you’ll want to be familiar with, but with an emphasis on how those concepts can be applied to solving problems.

Good luck!

Andrew Rothbart is an engineer working on Open Graph at Facebook’s London engineering office.

Leave a Reply

To help personalize content, tailor and measure ads and provide a safer experience, we use cookies. By clicking or navigating the site, you agree to allow our collection of information on and off Facebook through cookies. Learn more, including about available controls: Cookie Policy