Skip to content

Latest commit

 

History

History
28 lines (15 loc) · 10.8 KB

README.md

File metadata and controls

28 lines (15 loc) · 10.8 KB

LeetCode-Effective-Grind 🔥

5 STEPS YOU SHOULD FOLLOW :

  • What are the most relevant problems?

It is recommended that when you're studying in LeetCode make sure you actually focus on what are going to be the most relevant problems. There're so many problems on LeetCode. And so in your interview prep, you're never going to study all those problems. Even if you did go through them all, you're really not going to remember them. And so it's really important that you think about, like, what are the problems that are most likely to come up in my interview. Based on research it is found that it's a pretty small number of problems that come up, like, 90% of the time. So if you just focus on those problems, you're gonna get so much more bang for your buck. And there are a couple places that you can find the most popular problems on LeetCode and the ones that are most useful. So first of all, if you have a LeetCode Premium Subscription, you can see here that we can actually sort by the frequency. And that, I believe, is the frequency of how often people see the problems in their interviews. So this is a great place to start. You could do like the top hundred or so. A couple other places that you can look are we have this top 100 'like' and top 100 most popular questions on LeetCode. And those are available to everybody. So this is a great place to just look. You can see a list and go and just dig in. And it's a really great place where, if you're not sure where to start or if you just have a few free minutes, go on the list. Go to the first problem on that list that you haven't already done and it's a great place to just jump in. And finally, I'll link to this in the description below, but there's also this list on TeamBlind of some of the most popular questions that some people have put together. You can also just google like 'LeetCode best problems' or things like that. There are a lot of different results where people have compiled their favorites. And also a 50 questions guide as well over at byte by byte that you can check out that I would highly encourage you. It's byte-by-byte.com/50-questions . So those are a couple places that you can find some of the most popular questions that you're most likely to get asked in your interview, so that you can actually focus on what is likely to come up and not just do everything.

  • Understand the goal

First of all, you want to understand the goal, right. Understand the goal of what are you trying to accomplish with your time on LeetCode. What are you trying to accomplish with your time solving these problems? And the answer is that the goal is not to just look at the problem. The goal is actually to understand how the problem works so that... not so that you can solve that problem in the future, but so that you know how to solve similar problems in the future. And so it's really important that you focus on understanding, like, how to solve the problems, rather than focusing on what is the solution to the problem. So for example, if you get stuck on a problem... If you're going through a problem, you wantto spend about 30 minutes working on the problem before you give up. Because if you just give up after five minutes, you're never really going togive yourself a chance to even try and figure it out. But if you do get to the point of you're 30 minutes into the problem and you can't figure out what to do and you're totally stuck, you can look at thesolution. But then you have to understand what you need to do with that. So when you look at the solution, the goal is not to say, 'Oh, this is how it works...' The goalis to understand the thought process behind the solution. The goal is to say, 'I'm looking at the solution and how could I, in my own head, have come up withthis solution? What is the thought process that would have taken me fromthat original question to this solution?' Because if you understand that, then rather than just having to memorize the solution, if you understand that, you'llbe able to actually then go and solve it yourself when you see it in the future. So it's all about understanding an underlying thought process and not justunderstanding the solution itself.

  • Start with easy problems

So the next strategy I would suggest for you is starting with easy problems and then working your way up. So frequently I see people start with... they're like, 'I'm gonna do a medium problem or a hard problem...' and then they get totally demoralized because it's like they're starting above their skill level. And of course we want to push ourselves and we want to challenge ourselves, but we also want to make sure that we are giving ourselves the best chance of success. And so if you're doing stuff that's too hard, it's really easy to give up and it's really easy to like not make any progress because you're just like, 'I don't even understand what's going on here...' And so you want to start with the easy problems and work your way up. So I would encourage you with whatever sort of set of problems you're starting with, do the easy problems first, then the medium, then the hard and that way you're gonna sort of build up as you go. It's a really simple tactic, but it's gonna allow you to make sure that you are continually pushing yourself to improve, but you're not just like jumping way off the deep end and not having that success.

  • Simulate the real world

strategy number four is to simulate the real world when you're in your interview... when you're practicing for your interview. And this is so, so important and something that absolutely no one does because it's work. But if you put in the work, you're going to see such better results when you're actually in your interview. So the way that this works is that when you're solving a LeetCode problem, do not solve the problem in LeetCode. Period. Do not. You want to do it on a piece of paper or you want to do it on a whiteboard because that's what's going to be similar to what you're actually doing in your interview. You want to practice in that environment because that way you're going to get used to those other sort of factors that are like peripheral to the problem itself and you're going to get good and actually like working within those parameters. So the way that I would encourage you to do this is start by working out the problem on a piece of paper. You want to actually write all the code and code it up and then copy your code verbatim into LeetCode. So don't make any changes. It's gonna be tempting to see like, 'Oh, I made a little mistake here; I made a little mistake there...' Copy it verbatim in and try and run the code. Because your goal ultimately is that you should be able to copy your code verbatim, and it should run. You should have tested your code when you, like, write it by hand and you should have tested it by hand as well. And so the hope is that you're gonna put your code in and it's just gonna run. But more than likely, there are going to be issues. And so this is where you can actually learn what are the mistakes that you tend to make and start to improve on that. So when you type this in, you're gonna get some bugs. There're gonna be some things that just won't compile. And then chances are, there're going to be test cases that are gonna fail as well. So what you want to do is you want to keep an actual list of all of the different bugs, all the different syntax errors, all of the different tests that failed and what the fixes were. And what this is gonna allow you to do is it's going to allow you to identify for the future what are those mistakes that I keep making. And so once you have this list, now you can go back and the next time you do it say, 'Okay, well, I'm gonna check my solution for all of these specific mistakes. Did I put a semicolon at the end of the each line?' If you're coding in JavaScript, you should also definitely use a linter. You want... because with some of the languages things are gonna run even if it's not totally correct and you want to make sure that you're writing it as idiomatically as possible. And so in JavaScript use a linter, with everything else, just make sure that you are finding all of those little errors and make sure that you're fixing them. And then keep that list so that you can review it in the future every time you do another problem and you're going to be able to make sure that you are writing the best possible code when you're writing by hand.

  • Plan for when you get stuck

And finally number five... we touched on this a little bit already but I still think it's super important. What do you do when you get stuck solving a LeetCode problem. So it's so important that you don't just like give up and don't just like go to the solution. You want to make sure that you're actually trying to solve the problem. And so again, I would say spend thirty minutes on the problem. If you get to that 30 minute point and you still feel like you're making progress but it's just going slowly, keep working at the problem. Only give up on the problem if you spent 30 minutes and you're totally stuck. And then when you are stuck, go look at that solution, but focus on understanding what is it that got me stuck. What was the thought process that the person who wrote the solution was using and how can I sort of recreate that for myself? And what you may realize... what you're probably gonna realize is one of two things. On the one hand, it's like there's something about the thought process that you missed. You either didn't think about 'X' thing or, you know, you didn't have the concept of this. Or you're gonna realize that, 'Oh, I actually was missing like some basic knowledge. Like maybe it was a sliding window problem and you've never done a sliding window before. So in that case, you want to make sure that you're then keeping a list of like what are the topic areas or what are the types of, like, algorithms and things that I don't understand. Then you can go study that specifically. But you really want to make sure that you're getting as much as you can and getting as much mileage as you can out of every LeetCode problem possible. If it takes you an hour or two to go through one problem versus spending an hour or two skimming five problems and not really understanding them, it's way better that you spend all that time on one problem going really deep rather than spending that time on a bunch of different problems.

I just want to leave you with one last thought, is that it's better to make incremental changes than try and do everything at once and then give up on it. So what I would highly encourage you to do now is to pick one of these five strategies that we talked about in this video and implement it today. Just pick one strategy and start with that and then you can continue to add the other strategies as you go.

YOUTUBE VIDEO ON HOW TO EFFECTIVELY USE LEETCODE

YOUTUBE VIDEO ON HOW TO EFFECTIVELY USE LEETCODE