A few years ago, I managed to successfully pass the Google online coding test. It was extremely challenging. In this blog, I explain how I prepared for it.
Purpose of the Coding Test
The purpose of the online coding test is to identify candidates who may do well on the onsite interview. It basically measures how good problem solver, coder you are.
Exam / Test
You can use most of the popular programming languages (like Java, C++, Python, Ruby…). You will be talking to an interviewer throughout the test. Test usually last for about an hour. Given the time spend for introductions, coding part lasts for about 45 minutes.
Through out the exam you will be talking to an interviewer. Usually he would start with an simple coding question then add more and more complexity to it as you progress. You will be using google docs for coding.
Brush up your knowledge on data structures and algorithms. Cover all basics.
- Binary Search Trees
- Sorts – Merge Sort, Quick Sort, Heap Sort, Topological Sort
- Search – Binary Search
- Tree Traversals – DFS, BFS, Inorder, PreOrder and Post Order
Do not waste your time looking at too complex data structures/algorithms. It is very unlikely you will get a complex problem given the time limitations.
Learn to Calculate Time / Memory Complexity
You are usually asked to provide the time/memory complexity of your code.So brush up how to calculate this on a code. Also try to remember time complexity of above classic algorithms.
I highly recommend you to invest on Amazon best seller Cracking the Coding Interview: 189 Programming Questions and Solutions book.
This book covers all the algorithms, data structures that needed for your interview. It also covers Time and Memory complexity calculations. It briefly goes through the interview structure of the each big company like Google, Amazon and Facebook. This book also has lot of practice questions with solutions. Book is not cheap. But a very little investment considering that it will help to get in Google.
Practice Practice Practice
The practice is the key. Do as much as practice questions you can. If you buy above book, you try the practice questions of the book. There are several online web sites like Leetcode which provide practice algorithmic questions. Make the best use of them.
During the Test
Don’t Rush In
Don’t jump into solving problem too quickly. Questions are bit ambiguous; this is on purpose. So discuss the problem, ask questions to clear out any ambiguities you may have.
Think Out Loud
Also keep a good communication with the interviewer. Speak out your thought process. If you can think of several solutions to solve the problem, discuss them with the interviewer. Tell him which is the best solution and why you think it is. Also, you can access the internet during the exam.
Write Good Code
This is the first time Google is going to see your code. So try to give the best first impression. Follow basics; use meaningful variable/method names, move the redundant code to functions. Try to create classes instead of using complex collections. Try to output the best industrial level software you can.
Do not Brute Force
You may be tempted to solve some problems by brute force. But this will not raise any eyebrows. Try to provide a code that can do better than the Brute Force.
Personally, I took about 3 weeks to prepare my self for the coding test. So start early.