How to Use LeetCode Effectively
Is LeetCode really relevant in real life? The answer is... it doesn't matter 🤷 If you are a software engineer, you'll have to face LeetCode at some point. I’ve solved more than 650 LeetCode problems, so I understand how challenging it can be. Stop solving random questions. Study effectively and efficiently. Here's the game plan I used to land multiple jobs at FAANG.
Intro
Welcome to Pirate King. I'm PK, a Software Engineer at Microsoft, an ex-Software Engineer at Amazon and ebay, and also a Software Engineering Mentor at two educational startups. Here, we talk about tips and tricks on how to land a successful career in tech. So if you are interested in learning the clever strategies that increase your chance of landing the jobs, make sure to subscribe. In this video, I'm going to share an effective strategy for how to prepare for LeetCode. I have broken down the strategy into five steps to help you build a strong foundation in coding interview skills as quickly as possible. The motivation behind this is that as a Software Engineering Mentor, I have found so many people having trouble figuring out where to even begin. If you are one of those guys intimidated by the sheer number of questions on the platform, unsure where to start, and unconfident that you can pull this off yourself, make sure to stay until the end. Because I guarantee that you'll walk away with a clear game plan.
Step 1
The very first thing you should do is get a premium subscription. It's $35 per month or $159 per year, and no, I wasn't paid to say this! Despite the cost, I recommend it because it's totally worth it. I had my premium when I prepared for Amazon and Microsoft interviews. Its access to company-specific questions is a must if you want to drastically increase the chance of landing a job for that company. If you also think about it. You'll easily make six figures in salary if you get into renowned companies. You'll still make a decent amount anywhere else because the salary for Software Engineers starts at around $70k in the US. I can't imagine anyone not serious about becoming a Software Engineer having an interest in leetcode anyways, so make that investment for your future.
Step 2
Start with the Top 100 Liked Questions. These are not the questions handpicked by any individual or LeetCode itself, but the questions liked by the entire community - other leetcoders. And there's a reason why people upvote certain questions. Let me explain by giving examples of those that are downvoted. A question is heavily downvoted if it has too many tedious edge cases, is unclear or difficult to understand, doesn't require the concept of general data structure and algorithms (but very specific knowledge like math tricks), or the solution's just too messy. It's those questions you should avoid in the early stage because you want to concentrate on the ones that are simple and easy to follow. Questions that explore the core concepts of data structure and algorithms and are clean and straightforward are the ones that are great for establishing a solid foundation. I recommend starting with about fifty questions here. Avoid hard for now. Get a sense of where you are with fifty easies and mediums first.
Step 3
After you've explored the 100 liked questions, it's time to focus on the questions by topic. Don't just run off solving random questions. You've already done that from the 100 liked questions. Its purpose is to give you a taste of the platform and set the right expectations. Now that you have a taste of what coding interview questions are like, it's time to choose a topic and start drilling down. Don't just blindly attempt easies. How leetcode determines a question's difficulty is subjective and thus often inaccurate. Instead, order them from highest to lowest acceptance rate. It's objective because the data's community driven. In fact, the acceptance rate of some easies is lower than 50%, while that of some mediums is higher than 80%; leverage the stats. Let me tell you why this is effective. As you solve more and more questions from the same topic, you'll start to realize that there is a pattern to it. Realizing the pattern is basically the winning formula, the template, and the very algorithm you need to be successful at leetcoding. Once you've mastered it, or get that "tick", you'll realize that you can use it to solve most of the problems in the topic. For example, the binary search implementation that finds the left-most occurrence of an element, the four ways to traverse a binary tree, and the DFS and BFS templates in 2D array and graph problems. Two Pointers? Memoization? Tabulation? What would be a good situation to use a stack? a queue? recursion? or dummy nodes? You won't see what I mean if you jump around solving random problems. It's best understood by practicing similar questions on the same topic. Here's my recommendation. Solve at least twenty questions or until you get that "click" for each topic before moving on. Here's my list of topics to start you off: Recursion - Two Pointers - Binary Search - Binary Trees - Backtracking - DFS - BFS - Sliding Window - Linked List - Graph - Sorting. You don't have to follow this list. Just remember. For any topic, make sure to practice until you fully understand the pattern. It's the key to solving any problems within that topic. Once you feel confident, move on to the next; rinse and repeat.
Step 4
Now that you have this mini curriculum, practice with a plan. One. Don't attempt hard now. Start with easy and medium. Go for hard when you think you are ready. Trust me. You'll know as you practice. Two. Don't spend more than thirty minutes on an easy and an hour on a medium. In an ideal setting, we would try to solve a problem with our strengths alone. However, if you are leetcoding, chances are, you are doing it for jobs. And obviously, we don't have all the time in the world. If you can't solve it, just look up the solution and quickly move on, and promise me this. Three. Learn from the solutions. Like I said earlier, if you focus on solving problems on the same topic, you'll start to see the pattern and the techniques you need. And the best place to learn those is none other than the solutions. You can also find solutions outside leetcode as well. For example, there are a ton of videos on YouTube that actually does a better job at explaining than LeetCode. Four. Use the discuss tab. If the solution's not available on either LeetCode or YouTube, look them up in the discuss tab. You'll be amazed at the thousands of brilliant people in this world! Look at the clever tricks these smart people use and learn from them. Another reason why looking at the discussion board is helpful is that it helps you discover ways to optimize your code. Remember runtime complexity? It's not uncommon for you to submit a solution that's accepted by leetcode yet is still not optimal. Companies are not looking for any candidates who can just brute force their way through; they are looking for those who can optimize and find better ways to solve the same problem. Lastly five. Revisit your questions. If you had to look up the solution to solve a problem, you probably won't be able to solve it a week later; make sure to revisit them, just in case, to confirm that you can still solve it. Besides, it's a good way to review.
Step 5
Finally, Solve company-specific questions. After you've solved a good number of problems and gained a good understanding of what coding interviews are like, it's finally the time to do one! Do you have an upcoming interview with a company? Well, take a look at the list of companies available on LeetCode. This is where the LeetCode premium really shines. You can filter the questions by companies! You can even order the questions by their frequency in a select time period! All these wouldn't have made sense, however, if the data is inaccurate. From my experience, it's pretty accurate. In fact, my bar raiser question at Amazon onsite was one of the hard questions here. Three out of seven questions I was asked at Microsoft were from the list too. You might think less than 50% accuracy isn't that high. But given you don't need to be perfect to land a job, being able to ace even one is enough to put you in a great position! By the way, if you are interested in how I aced my Microsoft interview, you can check it out in this video.
Summary
So we've covered the five steps that help you effectively prepare for LeetCode. Let me summarize them again for you. Those steps are one, get the premium subscription. Two. Start with the Top 100 Liked Questions. Three. Focus on questions by topic. Four. Practice with a plan. Lastly five. Solve company-specific questions. I know you want to ask this question. "Can you share the interview questions you had for Amazon and Microsoft?" Well, I can; I always put them in my notes after each interview. But let me ask you this. Will that really help you? There are thousands of questions by Amazon and Microsoft on LeetCode; you probably won't get the same question anyways. The point is to establish a foundation. You already know that simply solving the questions I got won't be enough. Make sure to follow my steps. Practice! You'll find yourself improving day by day.
Check out the description below. Cuz I've put some useful resources and links in it. Don't forget to comment, like, and subscribe. Thanks for watching. I'll see you guys on the next one. Peace!