DEV Community

ahmedou-yahya
ahmedou-yahya

Posted on

I was leetcoding the wrong way

What you read here are lessons learned after solving 240 leetcode problems.

I have started my journey with Leetcode in mid-May 2020. It was a long journey full of ups and downs. Along the way, I have committed mistakes and learned a lot from them. In this article, I’m going to walk you through the lessons that I have learned and the mistakes behind them. So let’s get started:

1. Consistency: it’s a marathon not a sprint

The mistake that I made here is that one day I would solve 3 questions, the next day nothing, the day after that I would solve one. Where in fact it would be more beneficial to solve one problem daily as it refreshes your mind every day and is easier to keep on with. And to be honest with you it’s easier said than done, especially when it comes to DSA. But it’s the key to success, that’s why I started with it.

2. Pattern recognition:

When I first started, I was solving problems randomly instead of solving them topic-wise. Which in some ways ended up in me trying to memorize problems. That’s why I was not able to recognize patterns. So my suggestion for you would be to pick one topic, understand it and solve problems that fall under that topic. Something that helped me a lot in gaining this skill is @Kunal Kushwaha's DSA Bootcamp (link at the end), so huge shoutout to him for the amazing work that he is doing.

3. Quality over quantity: Learn depth-wise and not breadth-wise

In my case, I was rushing towards hitting that “100 problems solved”, which gave me a temporary satisfaction that I have achieved something. However, when looking at my skill set it’s not proportional to my progress. So my suggestion here is: for every topic, you should solve classic problems and take them as references whenever you are solving another similar problem. And that's what I exactly did. This brings us to the next point.

4. create a spreadsheet and document what you have solved:

As the title indicates, it would be better to document the problems that you have solved, how you solved them, is it the optimal solution in terms of time and space complexity, and what is the best solution. That way you can go back to them from time to time and refresh yourself without the need to code them again. Also, it will help you in preparing for the next interview.

5. Don’t compare yourself with others:

Seeing people solving all contest problems and seeing myself struggling to solve the first problem is really intimidating and discouraging. However what I didn’t realize is that it does not come overnight, it requires a lot of dedication and consistency. The only person you should compare yourself with is you, yesterday.

6. Take a break:

I would suggest you take one day's rest. That way you can refuel yourself.

Now, we come to an end. If you find it helpful drop me an emoji. If you have any questions, suggestions, or improvements leave a comment below and I will get back to you.


Finally, I would be pleased to connect with on Twitter here and LinkedIn here.

Kunal's DSA Bootcamp: Here

Top comments (0)