I handed over 90% of my coding interviews, and it is not as a result of I am some form of genius.
The vast majority of coding interviews within the knowledge science and machine studying area are carried out on LeetCode or HackerRank and usually ask questions on knowledge constructions and algorithms, or carefully associated questions.
And what I’ve found over the previous couple of years is you can “gamify” your interview preparation by practising sure methods and particular questions.
So, on this article, I wish to element precisely the method I went by to grasp coding/knowledge constructions and algorithm interviews in simply 6 weeks.
Let’s get began!
Cease studying knowledge constructions and algorithms
Step one could appear counterintuitive, but it surely’s really to cease attempting to be taught knowledge constructions and algorithms the normal manner.
In case you’re not acquainted with Knowledge Constructions and Algorithms (DSA for brief), listed here are some fast definitions of those phrases.
- knowledge construction : Arrange and retailer knowledge for environment friendly entry and modification.
- algorithm — A step-by-step process or algorithm for fixing an issue or performing a job.
DSA is the examine of construction knowledge and design environment friendly methods to course of it.
DSA has turn out to be one thing of a “meme” within the know-how world. It’s because these interviews check abilities which can be not often used on the job.
Nevertheless, this can be a crucial evil that ought to be practiced as it’s a part of many interview processes.
You probably have a level in pc science, you will have studied DSA as a module, however many individuals coming into knowledge science or machine studying have backgrounds in different STEMs, comparable to physics, arithmetic, or engineering.
So, naturally, these persons are extra prone to watch tutorials, begin studying textbooks, and use NeetCode as their main studying useful resource.
I did the very same factor.
At the moment, NeetCode’s “Data structures and algorithms for beginners” course.
List: Data Structures and Algorithms | Supervised by Egor Howell | Medium
Data Structures and Algorithms · 13 Stories on Mediummedium.com
The problem is that this didn’t actually make me good at data structures, algorithms, or cracking coding interviews.
I still had trouble solving basic problems like 2sum.
Don’t get me wrong. Neetcode is a great resource for learning concepts in broader areas such as DSA and system design. However, it’s not the resource itself, but the general approach to learning.
Learning theory is certainly helpful, but you also need to learn by doing at the same time to ensure understanding.
It’s similar to wanting to play tennis and learning the theory and techniques of swinging a racket, but not being able to actually practice hitting the ball. This is basically the whole game.
The same goes for LeetCode.
So I took a completely opposite approach.
I started solving problems before learning the topic. Then, after completing the problem or simply not being able to solve it, you will learn efficient solutions and accompanying theories on that topic.
This is my general process.
- Spend 30-60 minutes per day on two problems for about 6 consecutive weeks. First thing in the morning.
- You will have 20 minutes to solve each problem. If you can’t solve it within that time, use the remaining 10 minutes to come up with a solution.
- When considering solutions, we focused on learning patterns, not just answers. This is very important, memorizing the solution will not help you in the long run.
- Close the solution, wait 5 minutes, and then try to resolve the issue again..
- Rinse and repeat.
This approach changed my understanding of DSA. Because this approach required me to learn by doing, to put myself through the so-called “mental sweat.” Andrei Karpathy name it.
Passively watching a course or studying a e-book feels productive, but it surely’s really procrastination and avoids the precise work of fixing issues and studying by failure.
cease practising all subjects
Now, as an alternative of going forward and fixing random issues with Leetcode, I wish to give attention to a few of the subjects that come up probably the most.
For knowledge science and machine studying roles, even senior roles do not require as in depth DSA information as software program engineering roles.
In actuality, solely sure subjects come up ceaselessly in interviews, comparable to:
- arrays and hashes — Use hash maps/units for O(1) lookups to keep away from rescanning the information.
- two pointers — To skip nested loops, transfer two indexes nearer collectively (often in sorted knowledge).
- double sliding window — Develop/shrink contiguous ranges to effectively monitor optimum subarrays/substrings.
- linked checklist — Fastidiously rewire node pointers, typically utilizing quick/sluggish pointers or dummy heads.
- binary search — If the information (or solutions) is sorted/monotonic, halve the search area.
- stack — LIFO construction for matching/undoing and monitoring “subsequent larger/lesser” components.
- timber — Compute or search hierarchical knowledge by traversing recursively (DFS) or level-by-level (BFS).
- heap/precedence queue — Get min/max quick, good for top-Ok or “subsequent most pressing” issues.
- graph— Traverse nodes/edges by way of DFS/BFS to discover paths, connectivity, or shortest routes.
Focus solely on these subjects.
Subjects like dynamic programming, tries, and bit manipulation are very troublesome to be taught and do not come up typically in interviews.
The time you spend studying these superior subjects could possibly be higher targeted on different areas of the method, comparable to system design or behavioral interview preparation.
To be trustworthy, I’ve solely practiced 40 Leetcode questions, but it surely helped me cross over 90% of my coding interviews. A few of these have been focused at senior machine studying engineer roles.
These 40 questions have been purposely chosen as a result of they cowl vital subjects requested in interviews.
These have been sampled from standard NEET code 150 and blinds 75 These lists are primarily geared toward software program engineers, so that they particularly goal knowledge science and machine studying roles.
I’ve created a pleasant desk/database that summarizes these 40 questions. Try the hyperlinks beneath that will help you put together.
40 problems you must solve with LeetCode
These 40 issues led to over $200,000 in offers from companies like TransferWise, DoorDash, and multiple startups.problem.egorhowell.com
Obviously, these 40 questions don’t cover every question you might face in an interview, but they cover about 80-90% of the topics and types of questions you might get.
They are highest return on investmentProblems you can do in terms of time investment and passing the interview.
The purpose of this question bank is to optimize your time learning and practicing the concepts that appear most frequently during interviews.
We are intentionally not inclusive. It’s all a matter of strategy.
Don’t do it alone
Learning how to code and solve DSA problems is not that complicated. It’s all about consistency and taking it day by day.
If you prepare several days in advance, you are more likely to fail as you will not be able to learn DSA in a short amount of time.
It took me about 6 weeks to implement the strategy I mentioned earlier and be able to confidently code interviews by focusing on just 40 questions.
However, if you don’t practice over and over every day and stay consistent, the “hack” approach won’t work.
And this is where most people fail.
It’s like going to the gym. We know what we need to do and when we should go, but many people still don’t do it.
It’s not a matter of knowledge, it’s a matter of discipline.
This is why personal trainers exist. It’s about keeping you motivated and accountable to your goals.
LeetCode/DSA requires exactly the same thing.
When I was practicing, I literally had my mom check on me every week to make sure I was doing well.
That sense of responsibility and not wanting to disappoint my mother is what caused me to get into trouble even if I didn’t want to. Accountability is a crazy mechanism for consistency.
So I want you to do the exact same thing. Ask someone you know to check in with you every day and hold you accountable.
I do this with specific clients in my coaching program. I check in with them every day to make sure they’re doing the preparations they told me they were going to do.
This is the simple tracker we use, so feel free to make a copy and use it yourself.
That is extremely efficient and they’re all making nice strides in direction of their dream knowledge/ML jobs.
If you’re taken with working with me, please be happy to use beneath.

