Five things I have learned after solving 500 Leetcode questions

Why grinding Leetcode is not so bad

Anybody job hunting for a software development position is likely to know Leetcode very well, the website collects questions and solutions that come up in technical interviews for some of the most sought-after companies like Google, Facebook, and Microsoft.

These kinds of interview problems involving data structures and algorithms are becoming more and more popular even amongst smaller companies and this is a cause of frustration for many that argue their “leetcoding” skills don’t reflect their ability to do the job.

While I agree that not knowing Leetcode doesn’t make you a bad developer and it might be true that during your job you might never need to invert a binary tree, there are many things that grinding Leetcode can teach you which will prove beneficial during your career.

1) The importance of Data Structures & Algorithms

Leetcode is not a DSA course, and if you have no previous preparation on the subject you should definitely take a course intended to teach you the basics to be able to use the platform effectively, but it’s outstanding in helping you understand in-depth how they work and what they are best at.

Let’s be honest, a solid foundation of data structure is essential for every developer, I recently came across the story of how a simple algorithm improvement was able to cut 70% of the loading screen time for GTA V, and I know from experience how efficient implementation can allow an application to run smoothly even under stress.

2) There is always someone more knowledgeable than you

I am usually quite proud of my code after reaching a solution, but that often disappears when I read the comment section, where you can sometimes find implementations that beat even the official solution.
Honestly, about half of what I learned while doing Leetcode has been from carefully reading other people’s code and trying to implement their suggestions myself.

The idea that is always more to learn is even more valid in my work, I am lucky to have very experienced seniors that have really helped me improve, and this mindset of learning from others has allowed me to absorb as much of their knowledge as possible.

3) An edge case can ruin your day

Before I started working there was no real stake if I made a mistake in my code, a situational bug would never likely come out and be ignored.
This is completely different now that I contribute on a production codebase, with thousands of people interacting with my work any bug, even affecting a minor edge case, is likely to come out and cause an inconvenience or even damage to our clients.

Thankfully Leetcode is a fantastic training ground, every problem has hundreds of test cases often including every edge case that would break the code if not accounted for.
I realized how fundamental this is when recently I had to work with a database that didn’t have the proper constraints and contained unexpected values in many rows, thankfully I was able to address these issues in my code before they ever became a problem in production.

4) Hard work beats talent…

…when talent doesn’t work hard. I love this quote from Tim Notke and from my personal experience it perfectly applies to Leetcode, I know many fantastic and very talented developer that can’t do most medium question because they don’t know the patterns and the right tools to use and have not developed the proper structure to solve this kind of questions.

I was even worse than that when I started, I struggled with almost any easy question, but after doing a couple of courses about DS&As and grinding a lot of easys I was able to progress to the point where I can solve most mediums in a reasonable timeframe and even difficults half of the time.

I had another confirmation of the importance of practice when I recently switched from Python to Java for solving questions, while I use Java daily at work it doesn’t feel intuitive at all in this context and I can’t solve most questions without googling implementation details just like when I was a beginner.
This didn’t discourage me, now I know that given enough practice I will be just as proficient in Java as I am in Python.

5) Planning is an essential part of software development

Solving many problems during practice and in real interviews, I have quickly realized that coding is only a part of the process and writing a solution immediately after reading the prompt is probably the worst mistake one can make.
Software development is full of ambiguities and unexpected outcomes, coding interviews try often to replicate it by providing questions that are equivocal or not complete, it’s up to you to communicate with your interviewer and ask for clarifications and possible constraints.

Not only that, before writing the actual code you should suggest a solution, analyze its strength and drawbacks, and only start coding when everyone has agreed that what you have proposed is acceptable; if you start coding something that does not satisfy the time and space requirements it will be too late before you realize and you will have no time to implement anything better.

This is as important in an actual job, if you start writing code without analyzing the requirements and carefully thinking about your possibilities you are extremely likely to end up needing to refactor most of your work.


Personally speaking, I am lucky to like Leetcode and I don’t mind practicing on it even while not searching for a job, but I know many people that dislike it intensely and argue that it doesn’t teach anything applicable to a real job.
I hope that with my article I convinced at least some of you that it is not the case and that if you are forced to use it for interview prep at least try to gain something valuable from it, and hey, if you really don’t like it there are many jobs that won’t ask you Leetcode questions.

By the way, if you are struggling with Leetcode and want to improve I strongly advise you to try checking out Back to Back SWE on Youtube, his videos really helped me out understanding more complex topics, and if you need more structured learning you can also try his website and get 10% off with my affiliate code FEDE10.

Thanks for reading so far, feel free to connect with me on Linkedin.


Вам также может понравиться

Об авторе batyr