Hi, colleagues!
As we approach the end of 2023, LeetCode is honoring active participants with badges. I have consistently tackled problems for over 300 days, earning myself this badge.
An important note to emphasize is that this article is not about boasting about my achievement; rather, it focuses on cultivating a habit of daily practice, be it solving problems or revisiting those we tend to forget.
Personally, concepts like dynamic programming and sliding windows took a while to sink in, and problems involving diagrams left me baffled. Immersing myself in a continuous cycle of tackling challenges has proven effective in keeping my mind sharp.
In this article, I want to share an excellent life hack on how to always stay afloat in the IT market and keep yourself in shape by spending just 10-30 minutes a day in the morning. To start, simply allocate 10 minutes or more before work. I began my workday with a straightforward task.
Instead of having coffee and reading articles, I started by reading problems. Later, I shifted this activity after stretching and before breakfast – a brief period to wake up, gather myself, and engage my brain. As a result, coffee became unnecessary😌
For me, solving algorithmic problems has always seemed like something akin to an Olympiad, and I long failed to grasp its value. Many argue that it is necessary solely for passing interviews, and that knowledge of how to invert trees or traverse them in depth will never be useful in real life.
Partially, this is true, but when we start looking not only at high-level API libraries but delve into the logic, we begin to be amazed. Working with time, we can merge intervals; dealing with dictionary search, we can work with prefixes; working with a hash map, we can apply hashing algorithms. This is just the tip of the iceberg.
As soon as we start writing a lot of our own code, not limiting ourselves to using frameworks, we encounter the need to optimize code, check its complexity, and make it more efficient.
LeetCode is an excellent way to start tackling easy problems to understand what complexity is and how much it affects the result. Starting with simple problems, we devise solutions, becoming more and more efficient, and ultimately, identifying patterns.
It is precisely these patterns that allow us to determine how to solve a problem and what its complexity is. In most cases, we can solve it in several ways.
What does this give us? In short, at work on your project, you will learn to instantly assess the efficiency of your code, especially if your project is constantly under heavy load.
If your code transitions from cubic complexity to linear complexity, your servers and administrators will thank you. It also saves the company significant funds, especially when using services like Amazon.
It may seem trivial, but such optimizations can save several thousand dollars!
So, where to start? You have LeetCode, and you have problems, but what to do next?
It is recommended to begin by solving several "easy" level problems. Don't rush into the difficult ones right away. Take a sheet of paper and a pen, and start analyzing the problem verbally, without writing code.
After you have a general understanding of the problem and have considered edge cases, start writing code.
Solve a couple of problems per week, but don't rush. Gradually, you will develop an understanding of patterns and approaches to solving problems.
At some point, you will notice that your solutions repeat. This is where the time for patterns begins. If possible, consider a premium course on algorithms and data structures on LeetCode. There, you will find analyses of problems, video tutorials, and detailed solutions.
If you want to save money, turn to the resource neetcode, where free problem breakdowns are available.
Neetcode has effectively organized everything into a tree structure based on topics, as well as tasks that are commonly asked. Certainly, on LeetCode, the precision is much higher, as users can mark which problems were actually asked and frequently update the problem list.
However, I highly recommend exploring this resource and channel, even if you have been solving problems for a long time.
You can choose topics and tasks:
Take a plan:
And remember, failures in the beginning are normal. The key to this process is to learn and memorize patterns. As soon as you recognize a familiar pattern, solving problems will become much easier.
Whether tackling easy or medium-level problems, it doesn't matter — just solve them! If memorizing problems is what it takes, go for it!
There's no need to compare yourself to others, as we're in the process of cultivating a new and excellent habit. This habit will undoubtedly lead to significant improvement in the long run!
Good luck with your learning! If you have any further questions or need additional assistance, feel free to ask. Cheers! 🚀