This is the third chapter for our The Complete Guide to Google Interview Preparation series. When it comes to Google interview preparation, most people will think about practicing as many coding questions as possible.
It’s partially right because you certainly need to practice. However, very few people did it correctly. With the right approach, you can definitely practice smartly and get improved in less time.
In this chapter, I’ll explain in detail how to practice coding questions with practical tips as before. More specifically, you’ll know more about the following questions:
- Why we need to practice coding questions
- When to practice coding questions
- How to practice smartly (the post is mainly focused on this)
- Recommended resources
Why Practice Coding Questions
We should always ask ourselves why we need to do XYZ. If we don’t have a clear answer, it’s not worth the time and effort.
The harsh truth about coding interviews is that questions asked are not directly related to software engineer’s daily work. You will rarely implement a recursion algorithm in a real project and the most commonly used data structure is not tree, stack or queue, it’s just array.
However, the most cost-efficient way to evaluate an engineer is still through coding questions because no company can afford to give every candidate a one-month internship to evaluate his/her skills.
What it means is that unless a better form of interview is invented, coding questions are still the primary form of “exams”. To survive in this game, you have to get used to that type of questions that you may never encounter in real projects.
The point is not expecting the same question to be asked again (though this is possible), but getting familiar with this type of questions and they can also be helpful to your work potentially.
It’s so important that I have to emphasize multiple time here: it makes no sense to start practicing coding questions before you are very familiar with basic data structures/algorithms.
You should check our previous post and make sure your foundation is sound. The No.1 mistake is not that people don’t practice enough, but they start working on coding questions way too early. It’s like without a solid foundation, everything else is just crap.
Ok, so for the rest of the post, I’ll focus on how to practice smartly.
Several years ago, there were not any resources online and people didn’t know what to prepare. Now, you can find way more questions than you can practice. The idea is that you don’t need to finish every question you’ve seen online, nor do you need to go though all those online resources.
80/20 rule says that 80% of the effects come from 20% of the causes. And I’d like to help you identify that 20% you need to focus on.
Tip 1 – Write Down Solid Code
A lot of people are way too afraid to get their hands dirty. When practicing coding questions, all they do is to solve problems “with their minds”. If they have come up with a theoretical solution, they think they’ve solved the question.
In my term, coming up with the right approach is not even close to half done. This is because I’ve seen so many people who have failed to write down solid code even if their thoughts are completely right.
The most common complaints are “I was slow in implementation”, “I already had the right approach, I just didn’t get the code right”, “my code only has few trivial bugs” and so on so forth. IMHO, these are not trivial at all and it’s not something you can fix immediately if you can remember XYZ. In essence, these folks just didn’t write enough code. That’s it.
Stats shows that only 10% of programmers can write binary search without a bug. I hope this number can make you pay more attention to the code.
Tip 2 – Think Out Loud
Interviews are different from exams in that it’s an interactive process. Some candidates like to say “give me 10min” and then the everything is in silence.
Instead, it’s highly recommended to think out loud. There are lots of benefits from this:
- Show your communication skills
- Interviewers are more likely to correct you if you are not on the right track
- This can help you be clearer in your mind and prevent you from writing code before the idea is concrete enough
However, this advice is easy to tell but hard to act on. Most people are used to think quietly. Therefore, it’s important to think out loud in practice. In fact, you should do exactly the same thing as in an interview.
Another way to do this is to have mock interviews with your friends or experienced interviewers from Gainlo.
Tip 3 – Track Your Time
Most people like to practice in a safe and comfortable environment. Wrong! Remember that if your practice environment is too different from real interviews, you are very likely to have unexpected experience.
One of the most common complaints is “I didn’t have enough time to finish the code”. Honestly, I’m not surprised at all. How many people have paid attention to speed when practicing coding questions? Very few.
My advice is very simple. If you want to improve something, track it. Almost everyone would be surprised at how slow they are when they track it for the first time. Human beings are just bad at time estimation.
For Google coding interviews, each one is exactly 45min. You’ll say hello and introduce yourself for the first 5min and in the end, you can ask questions for another 5min. In the remaining 35min, you are expected to finish 2 coding questions and at least one of them requires writing codes.
Don’t forget that you will also discuss with the interviewer, so you may have less time to code. This is quite standard among other companies.
Tip 4 – Go Back To Basic Knowledge
Don’t practice coding questions for the sake of practicing coding questions. You need to figure out your weakness and be smart about selecting questions. No matter how hard working you are, there will always be more questions than you can prepare. Working on the right problem is the key to success.
In the beginning, it’s better to cover many different types of questions (e.g. linked list, recursion, dynamic programming, etc.). However, you should be more focused later on.
If you find yourself weak in one particular area, e.g. tree problem. There are usually two cases:
- Your foundation is not solid enough. In other words, you don’t have a clear understanding of the basic data structure/algorithm. In this case, no matter how many questions you’ve practiced, your problem is always there. What you should do instead is to review your textbook and address the root problem.
- Sometimes, you just need to practice more. Go find more questions of the same type and focus on this area for a while. It’s a more efficient approach than practicing aimlessly.
You won’t be able to practice with all questions online. Preparing with right resources can save you tons of time and that’s why I think everyone should be extremely picky about online resources.
Here are few resources I would recommend:
- Gainlo Coding Interview Questions – We covered a lot of questions that have been asked by top companies like Google, Uber recently with detailed analysis. I think the analysis process is much more valuable than the answer.
- Leetcode – I’m not suggesting you finish all questions on Leetcode. However, it marks questions with different level and it’s great to get an idea of where you are.
- Glassdoor – I would like to use this site at the final stage of preparation. Let’s say you are going interview Google in two weeks. You can definitely find recently asked questions there.
I don’t think you really need 10+ books/websites to practice. But for every single problem you’ve solved, you should treat it as questions from real interviews.
The point of this chapter is definitely not asking you to practice as many questions as possible. You should be picky about online resources and smart in practice.
Be clear about your strength/weakness and prepare accordingly. It’s important to be aware of yourself instead of working aimlessly.
If there’s one thing I’d like you to get from this chapter is to identify your 20% effort and focus on it as much as you can.
By the way, if you want to have more guidance from experienced interviewers, you can check Gainlo that allows you to have mock interview with engineers from Google, Facebook etc..