DEV Community

Amartya Chowdhury
Amartya Chowdhury

Posted on

You Don't Have to Grind LeetCode

Yes, you read it right. Everyone says "you should do 500 problems on LeetCode at least". And sure, to some extent, it is helpful. But it's not everything. You don't need to follow the same path if you see a bunch of people on Twitter/Linkedin doing a "100 days of code" challenge.

Are you inconsistent, no matter how hard you try?

Have you ever felt like no matter how much you try to be consistent, try to do at least one LeetCode problem a day, you just can't keep it up for more than a week? Do you have to force yourself just to be consistent?

So let's look at it from a different perspective. Let's say, like me, you are someone who hates the subject of biology. I have always hated that subject, to the point that I couldn't bring myself to keep my eyes open for 2 minutes without trying to force myself awake again. And I was a student who never slept in study sessions. No matter how much I forced myself to study biology, I could never do it well.

Sounds similar? Because it is. Maybe underneath all of the Twitter/Linkedin posts and flexes of LeetCode grinds and coding challenges, it has never even crossed your mind that maybe this LeetCode grind is just not what you love.

No LeetCode? Then what?

It is very much possible that you are the kind of person who just isn't built for LeetCode grinds. And that isn't necessarily a bad thing; it's just a different style. Maybe you are built for LeetCode grinds, or maybe you are someone who likes to see immediate results, someone who prefers building a website or an app to see their work in action, someone who likes to handle domains and manage servers, maybe even someone who's just a complete nerd that likes Linux and Vim (don't worry, I'm with you 😔).

Everybody has a different thing they love. Taking myself as an example again, I was never someone who liked solving LeetCode problems. That was primarily because I couldn't see any effects of my code immediately. I had always preferred building websites where I can see the fruits of my action. Even now, I am very development-oriented, although I don't really like frontend dev (sorry fellow frontend devs 😔). I currently build backend systems and infra/devtools, but the concept is still the same: building something actually useful and not just blindly solving random problems.

So, is LeetCode (or any problem solving) useless?

This is where most people misunderstand. I am not saying that LeetCode grind, or any kind of problem solving, is useless. It's the most important, in fact. DSA is a major factor in you becoming a better developer.

However, it's not essential that you learn DSA through just LeetCode problems. DSA shines the most when it's applied in real-life products. For example, build something yourself, maybe a backend or some library, and experiment about how to make it more efficient. Maybe learn about which algorithms would be better and more efficient, or just design one yourself. Maybe use a linked list instead of an array in some cases. That is where DSA shines. That is where real problem-solving takes place.

I'll put a little flex of myself again. I was working on my backend framework (Rensa), and my first draft of the routing system used plain arrays to store routes and route handlers. As a result, whenever a user would hit a route on the server, it would take O(n) time to search for the route (n is the number of routes) and it's handler and call it. Very inefficient for good backend servers. So, I researched a bit and stumbled upon Tries. Implemented route storage with that, and boom, the time complexity reduced to O(l), where l is the length of route. It doesn't depend on the number of routes registered, which is better as a server increases in size. Then a sudden enlightenment hit me all of a sudden, and I implemented a hybrid Trie+HashMap for storing routes. Now, although theoretically the time complexity was still O(l), but for completely static routes (like /home/dashboard, unlike /user/:userId), it practically worked in O(1) (constant) time, thanks to the newly introduced HashMap. (Read more about the entire approach here).

As you can see, you can start something small with just as much knowledge as you have right now, and with time and research you can keep on improving your solutions bit-by-bit.

Conclusion?

The conclusion is just that you don't need to feel guilty if you can't stay consistent, you just need to change your ways. Sure, LeetCode problems are definitely not useless and they do teach you about how many commonly encountered problems can be solved. But it's not everything, because ultimately, you will be having to build systems and not be only solving problems all your career.

So, the next time you feel demotivated because of inconsistency, just remember this:

If you have to force yourself to do something, it probably isn't for you. Time to change your ways.
Consistency will automatically follow you if you're doing something you truly love.

Time for some personal promotion, so before you leave, make sure to follow me on Twitter and LinkedIn.

Top comments (1)

Collapse
 
annasha_bhattacharya_3b28 profile image
Annasha Bhattacharya

Build > grind 💡🚀