Something I doubt most people think about when studying for coding interviews is how they choose which practice problems to solve. At some level, it’s not really necessary to think too much about it. It’s so easy to find practice problems that you can pretty much just grab a problem from wherever and get to work.
However, this haphazard approach is unlikely to yield the results you want. Choosing the right problems is crucial, particularly if you focus on studying fewer problems more in depth. It’s way too easy to end up working on problems that are the wrong level, cover the wrong topics, or simply aren’t consistent with problems you might be asked in your interview.
Push yourself out of your comfort zone but not too far.
Pushing out of your comfort zone is fairly common advice. In working out, it’s called progressive overload and is a proven way to get stronger. The same techniques apply to interview prep as well.Push yourself out of your comfort zone but not too far. Click To Tweet
However, in working out, there is an additional common sense rule, which is that you don’t want to push yourself so hard that you get hurt. For some reason, many people fail to apply this same common sense when practicing coding interview questions. Although everyone knows you need to challenge yourself, I find a lot of people take that way too far.
While you’re not going to get physically injured, working on problems way outside of your ability can be just as damaging. When faced with problem after problem that you can’t solve, it’s so easy to just give up. Failing over and over again is demoralizing and doesn’t actually help you improve.
The key is to pick problems that are just slightly out of your comfort level. If you normally do problems that are categorized as easy, try a medium problem. Your level also may not be the same across different subjects either. Don’t get discouraged when you struggle with problems that you think should be easy. You need to work your way up slowly.
Unless your recruiter specifically tells you that all of your questions are going to be on dynamic programming, don’t focus on that at the expense of everything else. Because there are a lot of different topics you can be asked about in your interview, you need to be conscientious about how much time you spend on any one topic.
The biggest problem I see here again and again is people spending a disproportionate amount of time on one particular topic that they find difficult. The topic that is by far the biggest culprit here is dynamic programming.
Now I’m not saying that you shouldn’t spend extra time on topics that you struggle with, but it’s important not to neglect the rest of your studies. Too many people will devote 100% of their time to a single topic and then mess up their interview because they’re not even asked about it and they didn’t prepare well for anything else.
When choosing how much time to spend on a topic you have to consider two factors. The first is how much you struggle with that topic. Most people get that, but what they forget is the second factor: How likely you are to be asked a question on a given topic during your interview.
To come back to dynamic programming, I find that dynamic programming interview questions are not nearly as common as people think they are. At most you’ll probably see 1/5 questions include dynamic programming, and those are likely to be very simple as far as dynamic programming goes.
Because dynamic programming problems don’t come up that frequently, the chance of you failing your interview even if you know zero about dynamic programming isn’t particularly high. Therefore you shouldn’t take all your time away from other topics that are more common and might need your attention to focus on something that may not even come up.
Wrong type of question
There are a lot of different types of coding questions out there. There are those designed for interviews, competitions, fun, education, etc. The fact that not all of the problems you will come across are geared towards interviews can actually pose somewhat of a problem.
While at some level any practice is good practice, it is also true that some practice is better than other practice. Practicing problems that are similar to what you will have to solve in an interview has the additional benefits of helping you to feel more at home when you actually go in for your interview.
Other issues are present, too. For example, a lot of succeeding in interviewing is about timing. You need to solve a problem fast, but not so fast that you make errors in your solution. You also may be expected to solve multiple problems in the given time, so you really only have half the time to solve the first problem given.
Practicing problems that are similar to those that you will see in an interview will help you to get a much better sense of timing. When you see a problem in an interview, you will have a decent idea of how long it is going to take you to solve it.
Places to find good questions
With all of these things to keep in mind about finding good interview questions, how do you find the right ones for you? Keeping the above rules in mind, here are a couple sources of good quality questions and solutions.
Note: Some of these links are affiliate links, which means I get a commission when you buy through these links (at no additional cost to you). However, I only recommend resources that I have used myself and truly feel will benefit my readers.
All of the problems on Byte by Byte are curated with interviewing specifically in mind and chosen to include a breadth of different topics. If you watch through the videos, I also make an effort to explain how you should approach the problem in your interview and how to work through it even if you’re initially unsure of the solution.
InterviewCake is another site that understands the necessity of quality questions over quantity. Although they only have about 40 questions, the problems they include are chosen with care. They include in depth explanations and hints for each problem that help you to work through the problem as though in an interview.
This behemoth has traditionally been the place people turned for coding interview prep and still has a ton of good practice problems. The newest edition also includes hints, similar to InterviewCake. The nice thing about CTCI is that there are good collections of questions on each individual topic, so it is good if there is something specific you need to focus on.
Protip: You can see what questions people have been asked in the past at the company you’re interviewing for by going on Glassdoor. While smaller companies don’t often have a ton of information, you may still find something valuable. More than specific questions, Glassdoor can help you get a great idea of what topics a company tends to focus on during interviews.
Although it’s not usually top of mind for people, the questions that you choose to study with can make a significant difference in your success. Taking the time to conscientiously think about what questions you will study is a great use of time.