After Solving 400 Leetcode questions, I have gained valuable insights and lessons that have shaped my approach to software development. Here are five things that I have learned
Many software developers who are searching for a job are familiar with Leetcode, a website that compiles technical interview questions and answers from top companies such as Google, Facebook, and Microsoft. However, the use of interview problems that focus on data structures and algorithms is becoming increasingly widespread among smaller companies, causing frustration for some who believe that their proficiency in “leetcoding” does not accurately reflect their job capabilities.
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 Significance of Data Structures and Algorithms
Leetcode is not a comprehensive course in Data Structures and Algorithms (DSA), and it is important to have a basic understanding of the subject before using the platform. It is highly recommended to take a course specifically designed to teach the fundamentals. However, once you have a foundation in DSA, Leetcode can be an invaluable tool for deepening your understanding of how these concepts work and their best uses.
It is important to note that having a solid foundation in data structures is crucial for any developer. A recent example of the importance of DSA is the story of how a small improvement in an algorithm led to a 70% reduction in loading time for GTA V. The efficient implementation of data structures and algorithms can significantly impact the performance and stability of an application, even under heavy usage.
2) There will always be someone who knows more than you do.
I tend to feel proud of my code once I have found a solution, but that pride often fades when I read through the comments section. I have come across implementations that are even better than the official solution. A significant portion of what I have learned while using Leetcode has come from closely examining other people’s code and incorporating their suggestions into my own work.
This belief that there is always more to learn applies to my professional life as well. I am fortunate to have senior colleagues who have generously shared their knowledge and helped me improve. This approach of learning from others has enabled me to absorb as much of their expertise as possible.
3) A seemingly minor detail can have a major impact on your work
Before I began my career, there were no real consequences if I made a mistake in my code. Situational bugs were unlikely to surface and would be ignored. This is not the case now that I contribute to a production codebase, where any bug, even if it only affects a minor edge case, can cause problems for our clients as thousands of people interact with my work.
Leetcode provides excellent training for this type of scenario, as each problem has hundreds of test cases, often including edge cases that would cause the code to fail if not properly addressed.
Recently, I had to work with a database that lacked the necessary constraints and had unexpected values in many rows. I was grateful to have the skills developed on Leetcode, as I was able to identify and address these issues before they became problems in production.
4) Diligence surpasses natural ability.
Exertion trumps innate skill when that skill isn’t exerted. Tim Notke’s quote speaks to me on a personal level, particularly when it comes to Leetcode. I’ve encountered numerous talented developers who struggle with even medium-level questions because they lack the experience and understanding of the problem-solving approach and tools required.
Initially, I too had a hard time solving even the easiest questions on Leetcode. However, after taking several courses on Data Structures and Algorithms and practicing regularly, I improved to the point where I can solve most medium-level questions within a reasonable time frame and even some difficult ones.
My recent switch from Python to Java for solving Leetcode questions has further reinforced the significance of practice. Despite using Java daily in my work, it doesn’t feel natural when it comes to solving these kinds of problems. Yet, I am not discouraged. I am confident that with enough practice, I will become just as skilled in Java as I am in Python.
5) Strategic planning plays a critical role in the creation of software.
Planning is a critical aspect of software development and cannot be overlooked. In the course of both practicing and participating in real interviews, it has become clear that coding is just one part of the process. The tendency to jump straight into coding after reading a prompt is a common mistake and can lead to undesirable results.
Software development is plagued with ambiguities and unanticipated outcomes, and coding interviews aim to replicate this by providing questions that are often vague or incomplete. It’s crucial to communicate with your interviewer and seek clarification on any uncertainties or constraints. Before starting to write code, it’s advisable to present a solution, assess its strengths and limitations, and only commence coding once everyone is on board with the proposed plan.
Otherwise, if the solution doesn’t meet the time and space requirements, it will be too late to make any necessary changes. This also holds true in a professional setting, as starting to code without properly analyzing the requirements and considering all options can lead to significant refactoring in the end.
Conclusion
As an individual, I am fortunate to enjoy Leetcode and find pleasure in practicing it even outside of job searches. However, I understand that not everyone shares the same sentiment and may see it as a waste of time and not applicable to real-world scenarios.
My LeetCode Profile - https://leetcode.com/durgesh4993/
Top comments (4)
Could you recommend some resources to learn DSA or ones that you used?
I love this article particularly the part about diligence. I think that's what I'm lacking and that I should just get on with it and start leetcoding
Codewars vs Leetcode?