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 how to say nice things to an interviewer, but you probably need that much time to learn to solve coding problems.
Problem-solving skills essentially mean how you reason a problem. Even if you encounter a previously unknown problem, you should be able to infer from known problems systematically. 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, you'll be implementing solutions after discussion with your colleagues most of the days. Your actual bug-free coding-to-specifications ability is essential. This is not hard to prepare. You 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 interviews 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 deriving mental solutions
1. Understand basic data structures
This means basic stuff like an array, stack, or 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. 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, which can be overwhelming. The good news is that there 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 well and be 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 what 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 usually rise to the occasion. Instead, we fall to our highest preparation.
Can't I figure out these patterns myself?
You totally can. It 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 with 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 OK. After we have 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 possible, you save much time and greatly expand your knowledge. This makes it easy for you to figure out the problem type during an actual interview quickly.
In summary, in Step 1, you can learn in an intro to online programming 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 sound system in place, all you need is the practice to conquer the coding interview.