Following the completion of 500 Leetcode questions, I discovered five things.
The website Leetcode, which compiles questions and answers from technical interviews for some of the most sought-after businesses like Google, Facebook, and Microsoft, is likely quite familiar to anyone looking for a career in software development.
Many people who believe that their "leetcoding" skills don't reflect their ability to accomplish the job are frustrated by the increasing popularity of these types of interview questions involving data structures and algorithms, particularly among smaller organisations.
Although I agree that not knowing Leetcode does not automatically make you a bad developer and it is possible that you would never need to invert a binary tree while working, there are many things that learning Leetcode thoroughly can teach you that will be useful to you in the future.
The importance of Data Structures & Algorithms
Leetcode is not a DSA course, and if you have no prior knowledge of the topic, you should attend a course designed to teach you the fundamentals so that you can utilise the platform effectively. Nevertheless, it excels in helping you comprehend in-depth how they function and what they are excellent at.
Let's face it, every developer needs a strong foundation in data structures. I recently read about how a simple algorithm improvement was able to reduce the loading screen time for GTA V by 70%, and I am well aware of how effective implementation can make an application function properly even under pressure.
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.
In all honesty, I learned approximately half of what I know about Leetcode by carefully examining other people's code and attempting to follow their recommendations.
I am fortunate to have extremely experienced seniors who have helped me much grow, and this mindset of learning from others has allowed me to absorb as much of their expertise as possible. This makes the idea that there is always more to learn even more true in my line of work.
An edge case can ruin your day
Before I started working, there was little to lose if I committed a coding error because a situational fault was unlikely to ever manifest and would be overlooked.
This is entirely different now that I'm contributing to a production codebase; thousands of people are interacting with my work, so any problem, even one that only affects a minor edge case, is likely to surface and annoy or even harm our clients.
Fortunately, Leetcode is a great teaching environment; every issue contains hundreds of test cases, frequently containing every edge situation that might cause the code to fail if not taken into account.
When I recently had to work with a database that lacked the necessary constraints and had unexpected values in many rows, I understood how important this is. Thankfully, I was able to address these issues in my code before they ever became a problem in production.
Hard work beats talent...
…when talent doesn’t work hard. I adore this quotation by Tim Notke, and in my opinion it is absolutely applicable to Leetcode. I know many wonderful and exceptionally gifted developers who are unable to complete the majority of medium-level problems because they lack the necessary knowledge of patterns, tools, and structures.
I was even worse than that when I first started; I had trouble with almost every easy question, but after taking a few DS&A courses and working through a lot of easy questions, I was able to advance to the point where I can finish most medium-level problems quickly and even difficult ones about half the time.
While I use Java daily at work, it doesn't feel obvious in this context, and I can't solve the majority of questions without Google implementation details, exactly like when I was a novice. This experience gave me further proof of the need of practise.
This didn't deter me since I now understand that with enough work, I can become just as skilled in Java as I am in Python.
Planning is an essential part of software development
I rapidly learned that coding is simply a part of the process of solving many problems during practise and actual interviews, and that creating a solution right away after receiving the prompt is arguably the biggest mistake one can do.
In coding interviews, ambiguous or incomplete questions are frequently used to mimic the ambiguities and unexpected results that are common in software development. It is up to you to interact with your interviewer and request clarifications and any potential limitations.
Additionally, before writing the actual code, you should propose a solution, consider its advantages and disadvantages, and only begin when everyone has accepted what you have suggested; otherwise, by the time you realise your mistake and have the opportunity to implement a better solution, it will be too late.
This is equally crucial in the real world; if you begin creating code without thoroughly considering your options and the requirements, you are quite likely to need to refactor the majority of your work.
Conclusion
Personally, I consider myself fortunate to enjoy learning and using Leetcode, and I don't mind doing so even if I'm not looking for a job. But, I am aware of many others who despise it bitterly and contend that it teaches nothing useful for finding a job.
I sincerely hope that my article persuaded at least some of you that this is untrue and that, if you are required to use it for interview preparation, you will at least make an effort to learn something useful from it. Hey, if you really don't like it, there are plenty of jobs that won't ask you Leetcode questions.