In our previous, we have discussed the importance of having a good basic conceptual knowledge. Once your foundation is strong and you are confident enough, the next step is to practice coding questions. All of us know that Google is loaded with coding questions and answers, there are good websites such as Leetcode and Lintcode, anyone could find it easily, so we are not going to discuss how to find such questions? We are going to talk about how to solve these questions. Like everything else on this planet, there is a proper way to practice coding questions. So let us discuss it!
Talking about the resources, I have practiced coding questions a lot of Leetcode and Lintcode. Choose any one website, both these websites have hundreds of coding questions. Interestingly, most of these coding questions are from the real interviews of big companies and they are increasing every year. I remember that the first time I visited Leetcode, there were only 300 questions. Now, the website has more than 690 questions. Here, each question is assigned a difficulty level. The questions could be easy, medium, or hard. You are free to choose the difficulty level but I would recommend starting with the easy ones. After solving a couple of easy questions, if you are comfortable and find it very easy, you may switch over to the medium questions. I would give you a pretty honest hint. If you want to work at Amazon, you should be able to solve every easy question and most of the medium questions. For Google and Facebook, you should be able to solve all the easy and medium ones, and most of the hard ones. This will just give you an idea of what these companies expect from a candidate and the future employee. Also, this will give you an idea about your own capacity and how much you need to improve.
Let us now discuss a few tips for solving coding questions
What does practicing coding questions mean? It just means solving a problem with the help of mind. Writing a solid code refers to writing a code that not only works but also results in great optimum solutions. This could only be possible if the coder has proper knowledge and confidence. Coming up with a something theoretical mean that its a solution. If you have the right approach, it means that you are in the correct way but you haven’t reached your goal yet! I have seen many people who have failed to write down the code or come up with a solution even if they were thinking in the right way. Some are also good when it comes to giving theoretical answers, but practically they aren’t able to implement the same theory.
When I used to be an interviewer, I often received excuses from people who weren’t able to solve coding questions. Complaints like, “I am slow in implementing”, “I wasn’t able to get the right code”, “Oh Gosh, my code has few trivial bugs”, “My approach towards the problem wasn’t correct”, and more. According to me, these complaints aren’t trivial. The only problem I could see was their basics. I was surprised to know that according to some stats, only 10% of the programmers can write binary search without a bug. I am mentioning such stats because I believe that it will inspire you to pay more attention towards the writing code. There is always a scope for improvement that can be achieved.
Most of us believe in practicing code in a comfortable environment. But this is utterly wrong! If you practice in an environment with your own comfort and preference, you will regret because interviews are conducted in a different way. I am not saying that you would in a physically uncomfortable environment, but mentally you will feel the heat. For example, a trainee pilot practices on a flight simulator machine, not just on a desk with a computer and a screen. If you practice in your comfort zone, the real interview will be unexpected and very uncomfortable. When I used to interview candidates, complaints like “Sir, I felt that the time allotted wasn’t enough to solve the question” were quite common. The only reason I could figure out was that these candidates prepared coding questions in their own way.
While you practice coding questions, always have a table clock on your desk, keep checking the time and try improving your performance. You will be surprised to know your speed when you would track it for the first time. In most of the cases, the candidates are pretty slow. You might be slow, but now you know it. While there is nothing wrong with being slow, it is definitely wrong if you don’t speed up.
Do you know how much time does Google during coding interviews? Google gives 45 minutes to each coding interview. Out of this, the first 5 minutes are consumed in the introduction. You are left with 40 minutes out of which, the last 5 minutes are allotted to the candidate for any queries. Finally, you are left with 35 minutes! In these 35 minutes, you are expected to finish 2 coding questions and at least one of them requires writing codes. This is a standard process among all the companies with minor differences in time allotment. So practice accordingly if you want to successfully crack the interview!
Practicing coding questions for the sake of practicing only won’t yield desired results. You will have to practice with a strategy by selecting proper questions. If you look at the list of questions, you will find different varieties of questions. Some might be easy for you, some might be difficult, some might be the ones which you have already practiced. Out of all these, pick up questions that you think are difficult and could be asked in the interview. In the beginning, try to cover as many different types of questions you can. For example, linked list, recursion, etc. Later on, be focused on typical confusing questions.
Know your weakness and work on it. For example, if you find out that you are weak in solving tree problems, you should understand that your foundation isn’t solid. The only way is to go back to the basics, review your textbook and clear the concept. Once you do that, start practicing tree related problems. Never be afraid of going to the basics, it will always help you improve.
Let’s summarize here. There is always a particular way in which everything is done and this article discusses some particular ways in which one could solve coding questions. Once you have all the resources and proper knowledge, it is time to get in action. So how do you practice coding questions? How would you master it? This article might be helpful in answering all such questions.
The article includes three tips which could be understood and implemented while practicing coding questions. The first tip is about writing a solid code. Thinking in the right direction is good, but it will only be effective if you are able to code correctly. The second tip is to track your time. Practicing in your comfort zone would lead you nowhere because things are different during the real interview. It would be useless if you consume more time to solve a problem. Even if you end up with the correct solution, completing it outside the allotted time limit won’t count. The third tip is to go back to your base and refresh your concepts. Even experienced developers need to refresh their concepts. There is nothing wrong if you go to the base and come up with something useful. So do it! I believe that once a person knows where he/she stands in the competition, that person would realize the amount of hard work required to win. So know your position, work with a goal, work with a strategy and be successful!
Here is the link to the previous article of this series.