paint-brush
7 Tips for Grinding Leetcodeby@TheAbbie
146 reads

7 Tips for Grinding Leetcode

by Abhishek ChaudharyApril 8th, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Leetcode is famous for being a perfect platform for practicing coding problems and to master coding interviews, unlike others, it is not for competitive programming, this guide will help you to get started with Leetcode without losing hope too early.
featured image - 7 Tips for Grinding Leetcode
Abhishek Chaudhary HackerNoon profile picture

Leetcode is famous for being a perfect platform for practicing coding problems and mastering coding interviews, unlike others, it is not for competitive programming, this guide will help you to get started with Leetcode without losing hope too early.

Tip 1: Follow a list

The biggest reason why people don't find DSA interesting is because they are unable to discover good problems which are easier to solve, simply solving popular questions with no track of questions will bore you very quickly. Even worse, you might try solving a really hard problem and lose motivation when it wasn't that hard, you just had to get a grip on it. That's why it's necessary to follow a list of questions, that way you won't have issues discovering new questions.

Solving problems in the right order is very important

You might see a question marked easy which isn't actually easy. The solution will be small, but sometimes, it isn't easy to come up with that solution if you haven't done a simpler version of it, thus, it will be demotivating.


Blind 75 Leetcode Questions


Above is an awesome list that is asked in interviews and is ordered by actual level of difficulty with prerequisites coming before harder questions. If you follow this, you'll feel more engaged. Once you have done most of this, do problems in the “similar questions" section below. Solve each problem till you master that category.


Once you feel confident, you can use these - Leetcode Patterns


Solve problems by category. This will help you master a data structure or some algorithm.

Don't get afraid of “hard" questions as there is no hard problem that can't be broken up. Try to break every ‘difficult’ challenge into smaller clumps. You might not be able to solve it but you'll convert it to a much shorter set of problems that can be solved with some practice. Thinking abstract and looking at the bigger picture is very important. Leetcode is addictive if you improve gradually, try it.

Tip 2: Avoid looking at solutions too quickly

It's not bad to look at solutions. After all, you can't know everything and learning is necessary. However, looking at solution just after a few minutes of brainstorming is bad. You have to give your absolute best and try every possible "inefficient" solution you can come up with.

The first phase is to figure out what Algorithm and data structure will be used. If you can determine what data structure will be used, you can check the Related Topics section to verify if your assumption was correct, and if after a few minutes, you can't figure it out, you should still check the data structure that will be used and then try to figure out how and where it will be used in the given problem.


Classic-Two-Sum-Problem.jpg


If you can come up with a solution that works correctly but isn't the best one, that's still a success as coming up with a brute-force solution is a bare minimum in an interview.


You can try improving the brute force solution by using some optimization techniques. You might find the optimal solution immediately, but improving a solution is a great skill. After spending an hour, if you can't solve the problem, you should understand that you just aren't well versed with the given algorithm and should try solving related problems with that data structure and understand how it works.

You should avoid looking at solutions as a solution you made yourself will help you much more. You should abandon the question and maybe revisit it in the future when you have some experience with that data structure. That way you can also track if you made some progress with that technique and if you could solve a new problem given to you in an interview,


Tip 3: Interview Questions don't come with hints

One thing to remember is that Interview questions won't tell you what data structure will be used for the problem. That's something you can only master with practice. The patterns and requirements of problems determine what's going to be used. There is no substitute for practice! Reading about algorithms will surely improve your range of thinking, but practice is what will help you master it.


Tip 4: Be Consistent

This goes without saying that practice needs consistency, simply overdoing it once and abandoning it for months will be destructive. It doesn't take much to take out some time every day for Leetcode, as far as discovering questions is concerned, you can use Daily Challenges to keep the consistency and maybe also earn Leetcode coins which might buy you a Leetcode T-Shirt one day.


Tip 5: Turn Demotivation into a learning opportunity

There will be times when you can't solve a problem despite all efforts, that's very common and bound to happen, but some questions being too hard is not something that should demotivate you. Every question is a learning opportunity and you have what it takes to learn it. Demotivation should be avoided and that's only possible if you have confidence in yourself and are willing to learn as much as you can.


Tip 6: Participate in contests

Even though Leetcode isn't a competitive programming platform, some contests allow you to try out brand-new problems and even compete with others. They have categories of 1 easy, 2 Medium, and 1 Hard, and solving 3 is more than enough. Once you have enough confidence in your problem-solving ability, these contests will help you gain interview experience as they don't have any hints, and solutions aren't available during the contest. This is pretty close to a real interview experience where time is limited.


Tip 7: Keep Hustling

Leetcode is an addiction and soon you'll fall in love with it, all you need to do is start, there is only one good time to start anything great, NOW. Just do it and you'll be satisfied with your decision and be proud of yourself. That's all, It's never too early and never too late.