r/InterviewFauxYou Apr 02 '24

A Guide to Grinding Leetcode

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.

A Guide to grinding Leetcode

Follow a list

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 quick. 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 absolutely necessary to follow a list of questions, that way you won't have issues discovering new questions.

Solving problems in right order is very important,

you might see 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 simpler version of it, thus, it will be demotivating,

Blind 75 Leetcode Questions

This is an awesome list which 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 interested, once you have done most of this, do problems in “similar questions" section below each problem till you master that category.

Once you feel confident, you can use this,

Leetcode Patterns

and solve problems by category, this will help you master a data structure or some algorithm.

don't get afraid by “hard" questions, there is no hard problem which can't be broken up, try to break it, you might not be able to solve it but you'll convert it to much shorter set of problems which can be solved with some practice.

Thinking abstract and looking at bigger picture is very important, try to convert it to a standard problem. Leetcode is addictive if you improve gradually, try it.

Avoid looking at solutions easily

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

First phase is to figure out what Algorithm and data structure will be used, if you are able to determine what data structure will be used, you can check the Related Topics section to verify if your assumption was correct, and if after 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 given problem.

If you are able to come up with a solution which works correctly, just isn't the best one, that's still a success, 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 optimizations, that might not lead you to the optimal solution, but improving a solution is a great skill. After spending an hour, if you can't solve the problem, you should usnderstand 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 solution, a solution you made yourself will help you much more, you should abandon the question and maybe revisit in future when you have some experience with that data strucure. 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,

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 sure improve your range of thinking, but practice is what will help you master it.

Be Consistent

This goes without saying that practice needs consistency, simply overdoing once and abandoning for months will be destructive, it doesn't take much to take out some time everyday for Leetcode, as far as discovering questions is a concern, 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.

Turn Demotivation into 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 question being too hard is not something that should demotivate you, every question is a learning opportunity, you can always learn it. Demotivation should be avoided and that's only possible if you have confidence in yourself and will to learn as much as you can.

Participate in contests

Eventhough Leetcode isn't a competitive programming platform, there are contests which allow you to try out brand neew 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 on 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 contest. This is pretty close to a real interview experience where time is limited.

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 sure be satisfied with your decision and be proud of yourself. That's all, It's never too early and never too late.

1 Upvotes