Wednesday, July 8, 2020
Chapter 3 Practice Coding Questions - The Complete Guide to Google Interview Preparation
Chapter 3 Practice Coding Questions - The Complete Guide to Google Interview Preparation 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. Its 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, Ill explain in detail how to practice coding questions with practical tips as before. More specifically, youll 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 dont have a clear answer, its not worth the time and effort. The harsh truth about coding interviews is that questions asked are not directly related to software engineers 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, its 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. When Its 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 dont practice enough, but they start working on coding questions way too early. Its like without a solid foundation, everything else is just crap. Ok, so for the rest of the post, Ill focus on how to practice smartly. Several years ago, there were not any resources online and people didnt know what to prepare. Now, you can find way more questions than you can practice. The idea is that you dont need to finish every question youve 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 Id 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 theyve solved the question. In my term, coming up with the right approach is not even close to half done. This is because Ive 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 didnt get the code rightâ, âmy code only has few trivial bugsâ and so on so forth. IMHO, these are not trivial at all and its not something you can fix immediately if you can remember XYZ. In essence, these folks just didnt write enough code. Thats 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 its an interactive process. Some candidates like to say âgive me 10minâ and then the everything is in silence. Instead, its 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, its 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 didnt have enough time to finish the codeâ. Honestly, Im 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. Youll 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. Dont 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 Dont 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, its 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 dont have a clear understanding of the basic data structure/algorithm. In this case, no matter how many questions youve 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. Its a more efficient approach than practicing aimlessly. Recommended Resources You wont be able to practice with all questions online. Preparing with right resources can save you tons of time and thats 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 Im not suggesting you finish all questions on Leetcode. However, it marks questions with different level and its great to get an idea of where you are. Glassdoor I would like to use this site at the final stage of preparation. Lets say you are going interview Google in two weeks. You can definitely find recently asked questions there. I dont think you really need 10+ books/websites to practice. But for every single problem youve solved, you should treat it as questions from real interviews. Summary 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. Its important to be aware of yourself instead of working aimlessly. If theres one thing Id 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..
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.