I was leetcoding the wrong way
Tags: leetcode, programming, algorithms, interview
Published: 2022-04-19 16:43:04

What you read here are lessons learned after solving 240 leetcode problems.<br/>
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:<br/>

<h3>1. Consistency: it’s a marathon not a sprint</h3>
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.<br/>

<h3>2. Pattern recognition:</h3>
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](@kunalk)'s DSA Bootcamp (link at the end), so huge shoutout to him for the amazing work that he is doing.<br/>

<h3>3. Quality over quantity: Learn depth-wise and not breadth-wise</h3>
 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.<br/>

<h3>4. create a spreadsheet and document what you have solved:</h3>
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.<br/>

<h3>5. Don’t compare yourself with others:</h3>
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.<br/>

<h3>6. Take a break:</h3>
I would suggest you take one day's rest. That way you can refuel yourself.<br/>

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.
<hr/>
Finally, I would be pleased to connect with on Twitter <a href="https://twitter.com/ahmedouyahya7">here</a> and LinkedIn <a href="https://www.linkedin.com/in/ahmedou-yahya-4946b0183/">here</a>.<br/>
Kunal's DSA Bootcamp: <a href="https://github.com/kunal-kushwaha/DSA-Bootcamp-Java">Here</a>