How to Conquer The Coding Interview
What interviewers look for
On the technical side, there are a couple of things interviewers look for:
- Problem solving skills
- Bug-free coding abilities
For non-technical qualities, there are things like communication, culture or even "leadership principles" (looking at you, Amazon), but those things are much easier to prepare. You don't need two months to learn to say nice things to an interviewer, but you probably need that much time to learn to solve coding problems.
Problem solving skills essentially means how you reason a problem. Even if you don't know a problem, you should be able to systematically infer from known problems. In his classic book "How to solve it", mathematician George Pólya offers many good tips: "look for a pattern", "draw a picture", "solve a simpler problem". We will use some of these techniques in AlgoMonster's articles.
Bug-free coding is self-explanatory. Unlike the tricky math problems you get asked during interviews, most of the days you'll be implementing solutions after discussion with your colleagues. Your actual bug-free coding-to-specifications ability is especially important. This is not hard to prepare. You just have to practice A LOT.
At AlgoMonster, we love systems. We are big believers in systems over goals.
Throughout this website, you'll see systems for solving common interview patterns such as the three-step system for backtracking. For mastering coding interview in general, we have summarized a three-step system:
- Understand how basic data structures work like the back of your hand
- Mastering common patterns through practice
- Working through many problems and derive mental solutions
1. Understand basic data structures
This means basic stuff like array, stack, linked list. Stuff you'd use in daily programming. If you have any real-life coding experience, you should know these already. Although depending on your understanding, you may have to brush up on how things work behind the scene a little bit. We have language-specific data structure overviews to get you started.
2. Mastering common patterns
There are literally thousands of problems out there on the internet you can practice and that can be really overwhelming. The good news is they are only a handful of common patterns you need to know. Once you master the patterns you'll be able to apply the techniques to solve other problems. The key is to understand the common patterns really really well and being able to code them bug-free. For each pattern and its example problems, we have inline editors and test cases for you to practice what you've learned right away. Do this as many times until you can code them bug-free quickly.
Why mastering the pattern is important
Because we don't know what we don't know. Humans can only infer from the things we know. If a problem requires prior knowledge and we don't have that knowledge, then it's essentially intractable. This is especially true in a coding interview with limited time. When the pressure comes, we don't normally rise to the occasion. Instead, we fall to our highest preparation.
Can't I figure out these patterns myself?
You totally can. It just takes time and experience to do many problems and figure out patterns. To quote Issac Newton, "if I have seen further it is by standing on the shoulders of Giants." We've done the leg work for you. And we are constantly updating the content to stay up to date to current interview trends.
3. Work through many problems and derive mental solutions
The third step might seem odd at first glance. Shouldn't you code every problem you see? In theory, yes. But we only have so much time in a day. We have our jobs, school work, or even kids to take care of. We don't have time to code every problem out there. And that's totally OK. After we mastered Step 2, we should be able to look at a problem, identify which pattern it belongs to, and derive a mental solution. By going through as many problems as you can, you save a lot of time and greatly expand your knowledge. This makes it easy for you to figure out the problem type quickly during a real interview.
In summary, Step 1 you can learn in an intro to programming online course. Step 2 is what AlgoMonster is designed for. Step 3 you can achieve with websites like Leetcode or Hackerrank.
Doing coding interviews is no easy task. But with a good system in place, all you need is the practice to conquer the coding interview.