Saturday, April 20, 2024

Doing Leetcode the wrong way

 Original post: Link

It has been 4 months since I solved problems every day on Leetcode.

I realized that I was doing Leetcode wrong at the beginning. I did not come to Leetcode to prepare for interviews. I’m too old to start a career at the FAANG companies to be honest. No, I love puzzles and in the beginning, I thought I was testing my programming IQ. I was wrong of course. I spent hours if not days on some problems and I was not able to solve them. Even after looking at someone else's code, I could not understand how it worked…

That’s because like many who start here, I was doing Leetcode the wrong way. You’re not supposed to find the algorithms by yourself. Of course, there is a lot of satisfaction in finding one by yourself, but unless you’re a true genius, you're not going to find what the Dijkstra, Bellman, and so on found with their brilliant intellect.

No, the good way to use Leetcode is to use it to learn. If you don’t find the solution to a problem relatively quickly, say one hour, stop there. Read the solution, understand it and try to reproduce it. Even if you’re into competitive programming, that's the way to do it: you learn the patterns and then you apply them wherever it fits. Read also the many variations of solutions and learn from the best.

Also try to explain your solutions (that’s part of the Feynman method “Teach it to yourself or someone else. …”. If you can’t explain it clearly it means that you still have not completely absorbed the concept.

And don’t be impatient. If you cannot grasp Dynamic Programming in 2 days or even one week, don’t worry, many people got there. Persist, and at some point, it will click. Practice, practice and practice. You’re not a genius, but you’re not stupid. Let yourself have the time to learn.

Don’t compare yourself to others. You will see comments like “This Medium question should be labeled Easy” and then you despair because even easy questions feel hard for you. The thing is once you have learned something it becomes easy. If you try to compare to others you are comparing apples to oranges. Different people at different stages of their development will never experience the same level of difficulty. So ignore these comments and focus on your own progress. Compare yourself to where you were a few months ago and appreciate the progress you made.

Happy leetcoding to all.

No comments:

Post a Comment

Amazon OA Questions Compiled

 Original post: Link Here is a list of Amazon OA i have compiled during my preparation. Sorry if the problems are repeated. I hope this help...