How to Master Coding Interviews: The PTS System
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 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.
The "PTS" System
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. For mastering coding interviews in general, we have summarized a three-step system called "PTS" (pronounced "points", how clever we are!):
- Patterns: Master common patterns
- Templates: Never make coding mistakes again using our templates for each pattern
- Speedrun: Expanding your knowledge by going through many problems quickly
0. 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.
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.
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 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.
You need to understand the common patterns well and be able to code them bug-free, in 10-15 min during an interview. We distilled the pattern code into templates. Use the inline editors to practice coding using these templates against test cases. Do this as many times until you can code them bug-free quickly.
Once you've mastered the patterns and being able to code them correctly, you want to work through many problems and derive mental solutions. This 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.
To help you with that, we have a Speedrun feature. Instead of coding each problem, you will be given a multiple choice question related to the techniques and templates used to solve the problem. This cuts down the time to go through many problems significantly.
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.
Some notes before we move on to the next section:
- The problems on the website do not always have all the test cases. The goal of the platform is to help you learn the patterns and techniques as quickly as possible, not to be exhaustive in test cases. In a real on-site/virtual interview with an interviewer, you will be asked to write code on a whiteboard or a shared editor. And there are no existing test cases to run against your code as you'd do on LeetCode or Hackerrank. The interviewers may ask you to write/think of a few test cases that cover the basics as well as some edge cases. In addition, explaining your thought process and how you came up with the solution is also important. So don't fret if you find a problem that doesn't have all the test cases. For majority of the people, the goal is to learn the techniques to pass the interviews as quickly as possible, not to become a competitive programmer.
- Currently we have limited video content. There are however interactive illustration that you can play around to understand the algorithms. We are working on the video content. But we have a lot of content already. So we hope you can get started with the written content first. We will add video content as we go. Be sure to subscribe to our Youtube Channel to get notified when we have new videos.
Still not clear? Submit the part you don't understand to our editors.