Tips For The 2016 Google Code Jam
The qualifying round for Google Code Jam is only a few hours away. Google’s annual competition is a great way to benchmark your coding skills against some of the best developers across the globe. Is this your first time participating? Are you a seasoned pro? Here are a few tips to help you do your best during Google Code Jam, or any other coding competition, regardless of your skill level.
Just go for it
This is honestly the most important tip I can give. Many developers that I’ve spoken to about Google Code Jam fall in two categories: People who have never heard of Google Code Jam and people who wish they participated. Register and give it a shoot.
Set aside a few hours, at least three
You have 27 hours to come up with a solution to the Code Jam problems. Depending on your abilities, it may take anywhere from one to four hours per problem. I recommend setting aside at least three hours. Three hours gives you enough time to review all of the questions and complete the one you determine is the easiest.
Have a secondary goal in mind
Google Code Jam is tough. Personally, I have qualified once out of four attempts. I didn’t set aside enough time or just wasn’t able to get enough points. Have another technical or professional goal in your back pocket so you don’t feel like you come out of the competition empty handed. Here are a few goals you can attempt so you come out a winner, even if you don’t qualify:
- Have code examples to show for your next job interview
- Get a better understanding of unit tests
- Make your first public repo on GitHub
Read all the questions, focus on what you can solve
I can’t stress this one enough. Read all the questions! Each question varies in difficulty. Some questions will be easy, others will leave you scratching your head. Read all of the questions and determine which question is the least challenging. Focus on the question that you know you can solve first.
Sketch out or Whiteboard your solution
Grab a blank piece of paper and a marker once you know what question you are working on. Sketch out how you want to solve the question. Figure out what data structures you want to use, how you will handle the input, how you will generate the output, etc. Most of your time will be spent crafting an algorithm to process the data Google gives you. It’s easier to start coding once you have an outline of what your algorithm will look like.
Know the language you are using
Most of your time will be spent coding. Here are a few things you should already know how to do in your language of choice. They may sound simple, but they are things you don’t want to be struggling with during the competition
- Read an input file
- Write a file
- Lots of array manipulation
- Available Data structures (Arrays, Sets, Dictionaries, etc.)
- Garbage Collection
Run unit tests against the sample input
Love them or hate them, unit tests are another great tool to use during the Code Jam. Google gives you very clear input and output. These will be the easiest unit tests you ever write. Take advantage of the clear requirements and create a few unit tests. Be sure to test edge cases, such as the maximum amount of variables your input can process,
PROTIP: Run a unit test 100 times against each of the examples Google gives. If it doesn’t complete in under a minute you are going to have a bad day
Know how the submission process works
Submitting your answer can be rough on newbies and seasoned pros. You’ll have a 4 minute or 8 minute window depending on the dataset to download the input file, process the dataset and upload your output with the source code. So firsts things first, have your code ready to be shipped to Google BEFORE you start the submission process. You don’t want to waste time creating your package while the timer is running. Trust me on this one. Also, I suggest you do a dry run to understand how the process works.
Log for performance to find bottlenecks
A common hangup in the Code Jam is taking to long to process the dataset Google provides. Log the input and how long it takes to generate an answer to a separate file. This will help you focus on bottlenecks so you can optimize your code if you have to attempt a question again. Create a new log file each time or append to your log. You want to see how many seconds you shave off with each improvement you make.
Promote and publish your code
Don’t let your code sit there once the competition is over. I’ve demoed my work on previous Google Code Jams during job interviews. It’s a transparent way to demonstrate your abilities as a developer and will leave a great impression during any technical interview. I highly recommend it. If you aren’t on the job market put your code up on GitHub. It’s good to build a portfolio of work that you can share with others because often your day to day code can’t be published for various reasons.
One Last Tip…
Have fun! You are coding in your spare time, enjoy it. Grab some snacks and your favorite carbonated beverage. Try to get a few co-workers in on the competition and see who qualifies. Enjoy it.
Did I miss anything? Have any words of wisdom? Leave a comment or hit me up on Twitter, @uz88.