The 4 step method my students use to maximize Leetcode Problems and ace their FAANG Interviews
Aside from my machine learning research, I am also involved in tutoring people to ace their technical interviews. The people that reach out to me are of two types.
- They are students struggling with coursework. This is the most diverse group, and they ask me to help with everything from coding, to math, machine learning, or theoretical computer science (who didn’t struggle with Finite Automata).
- Working professionals. These are people that are working full-time jobs in tech. They have decided to either transition into software development (like this student of mine who nailed a Facebook Software Dev job after starting off as a front-end dev), or are midcareer professionals just looking to do well in the technical interviews. These are busy working professionals, who need to brush up on concepts and/or just brush up on their technical interviews. I’ve worked with people with up to 20 years of industry experience.
These two groups have very diverse needs. However, people in both groups express some difficulty with solving Leetcode problems (and learning from their mistakes when they do solve a problem). In my experience, this comes from using Leetcode/HackerRank, etc in an inefficient way. They typically spend hour-1.5 hours on the problem. Then they give up and look at the solution. And they repeat this process. This is fine, but this is missing a crucial ingredient. Feedback. In the rest of this article, I will elaborate on what this ingredient is, why it’s important and how to integrate it. Using my experience helping people as my base.
Why should you listen to me? Here is a text communication with a student J. J is a 15-year working professional, who struggled with even easy-medium Leetcode problems. We’ve been working together for about on and off for 2 months. Due to her hectic personal life, she can’t dedicate many hours to practice and often has to even cancel our scheduled classes. As of now, we’re taking a small hiatus as J handles some personal circumstances. However, in that time, she has been able to improve her problem-solving skills. Prior to our working together, she felt hopeless attempting the coding interview problems. Now, in her words, she is “slowly building logic.” I will provide many more examples later in the article. Now that I have provided proof of work, let’s proceed. Here is another statement given by a student that nailed their Google screen.
Step 1: Reading the Problem Very Very Closely
This might seem like an obvious step. But it plays a very crucial role in your ability to learn from the problem. When you read the problem, you need to do a few things. Highlight the areas of the problems you think are important. Note down what phrases you think are important, and what data structures/algorithms they might be hinting towards. This step will be very important in the end, where you learn from the solution. By doing so we can see if there’s certain topics you miss thinking about. We can also see if you tend to think of certain structures many times (I had a student who thought on tries anytime a string problem came up. This had mixed results).
Step 2: Working on the problem
I generally have my students work on a problem for about an hour-1.5 hours. This might seem like a lot since coding interview problems are generally about 30–45–60 minutes. But here, our objective is to practice in problem areas. So we can afford to go slightly over the time limit. For simulating the time constrained pressures, we also do many mock interviews. Here the objective is to truly understand the nuances of the problem though. So taking more time is okay.
While working on the problem I recommend thinking out loud. This gets you in the idea of communicating your ideas while solving a problem. And the benefits of speaking out loud while thinking have been well documented.
Step 3: Review the solution
This step is also extremely crucial. Remember all the thinking you did in Step 1? This is where it comes into play. Look at the solution. What kind of data structures did they use. Was there a specific algorithm that you missed? Was there something that could have hinted at the steps they used? At what points did the solution diverge from what you had in mind?Such contrastive learning should be your goal. It will help you understand what areas you’re missing.
The goal of this step isn’t just to see the solution. It is to understand where you missed out on getting the solution. This can help you direct your efforts in specific areas.
Step 4: Alternative Solutions
This is a step that a look of people overlook. However, it can be the difference between an almost and a yes in the decision making process. Even if you have the optimal solution, I would dedicate using some time to explore alternative solutions. Could we reduce the space usage (even if time complexity goes up)? Can we use other data structures/ frame the question in another way? What other ways could we solve it?
This will naturally get you in the habit of exploring trade offs in an interview (a good chance to show of your knowledge). It will also be a useful skill to have when you’re stuck. My suggestion to students for when they are stuck on a problem is to take a shotgun to it. They want to start exploring other ways and other prospective solutions. Remember. An inefficient solution is infinitely better than no solution.
Hopefully this article given you a useful framework on how to approach Leetcode problems to get a lot out of them. You will notice that with this approach, you will spend a lot more time on a question than average (towards the beginning). This is to be expected. As a beginner, it is important to have guidance in this area. While you won’t be able to crack 10 questions a day (or even 5–6) you will start seeing results very quickly. Don’t believe me (I’m hurt if you said yes)? Here is an example of my student who was a Front End developer with no experience in Computer Science (she didn’t even know recursion when we started). She had an interview for Facebook Software Development position. We worked together for 4 months. This was the result.
This method works. It will allow you to maximize your Leetcode practice. One or two high quality practice questions is worth much more than doing 10 questions without learning from them.
For a teaser of my tutoring
Reach out to me
If that article (or the recommendation) got you interested in reaching out to me, then this section is for you. You can reach out to me on any of the platforms, or check out any of my other content. If you’d like to discuss tutoring, text me on LinkedIn, IG, or Twitter. If you’d like to support my work, using my free Robinhood referall link. We both get a free stock, and there is no risk to you. So not using it is just losing free money.
Check out my other articles on Medium. : https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd
Reach out to me on LinkedIn. Let’s connect: https://rb.gy/m5ok2y
My Instagram: https://rb.gy/gmvuy9
My Twitter: https://twitter.com/Machine01776819
My Substack: https://devanshacc.substack.com/
Live conversations at twitch here: https://rb.gy/zlhk9y
Get a free stock on Robinhood: https://join.robinhood.com/fnud75