A story about how I solved more than 600 leetcode problems in a year

I want to tell you a story about how I started from the level “I can’t solve even 1 easy problem out of 10” to the level “I can solve every second medium problem” and went through several coding sessions in companies such as Booking, Careem, Avito. ..Fireworks to everyone!

It all started with the fact that at the end of 2022 I firmly decided that I wanted to get a job in a FAANG company, but for this, as you probably all know, you need knowledge of algorithms and data structures, which I did not have, because in normal work you heap, tree, disjoint set and other data structures are not needed, so we had to start almost from scratch.

It was very difficult, because… I didn’t know where to start, what principle to use to solve problems, what was important and what wasn’t, how many problems needed to be solved in order to feel confident, whether it would be possible to switch to medium tasks at all, because… solving even easy problems led to a dead end, below I will try to answer all these questions.

The very first thing that comes to mind when you want to start solving problems using litcode is to open task page and start solving them in a row, but this is not a very good idea, even if you have applied the easy filter, because a lot of problems marked easy are very difficult to solve and this can be very demotivating, or even lower self-esteem.

Council

  1. The first tip is to pay attention to the Acceptance percentage, the higher this percentage, the better, because this means that many people can solve this problem and there is a chance that you will succeed too. You can also open the study plan and try to solve problems from there :
    Top 100 liked tasks, if there are a lot of likes, then there is a chance that this is not some intricate task that can lower your score (there are many tasks that require specific knowledge and this may not be obvious at first glance)
    Top 150 problems to prepare for an interviewthe likelihood of meeting these tasks in an interview is high, but there may be complex tasks that will be difficult to solve at the beginning of the journey
    – As leetcode writes, это “Must-do problem list for interview prep”. The tasks in these lists are divided into different topics; you need to solve them by following the following advice.
  2. The second tip is to start with the most fundamental data structures, such as array (one-dimensional/two-dimensional), set, hashmap, you will encounter them all the time, for example, in many tasks the execution time can be improved by adding a set or hashmap (but you need to take into account that it will increase memory consumption) and only after you have mastered them, you can begin to delve into other structures like stack, queue, linked list, tree, graphs.
    On leetcode itself there are cards that explain data structures and algorithms + tasks to reinforce these topics, as written above, start with simple cards – array, string and gradually increase the level, I returned to the cards several times, because… some points were sometimes not clear the first time, so don’t think that there is something wrong with you, if something is not clear, you will come back later and find that you already understand it.
    There is a roadmap with topics and tasksI highly recommend
    Here you can create a weekly plan using various filters
    List of 150 popular problemsdivided into topics, complexity and companies
  3. The third piece of advice – if you can’t come up with an optimal solution, start with a solution “head-on”, as soon as you can, think about how this solution can be improved, maybe you can use some kind of structure? Maybe the array can be sorted? what if you use set or hashmap? is it possible to use some kind of template? If nothing helps and you have already spent 20-40 minutes, then feel free to open the solution to the problem and study this solution, as soon as you have done this, close the solution and try to solve it again (there may be several such iterations, this is normal!), if after several iterations did not work, just retype the solution (I did this many times), BUT do not forget to return to this problem after a while and try to solve it again (it is likely that it will not work and this is also normal, just repeat all the steps again, I have had cases where when I solved the same problem 10 times until I was absolutely sure that I understood exactly).
  4. Tip four – take a walk according to my 14 templates, especially pay attention to two pointers, sliding window and fast & slow pointers, because they are the most common. Take a template, find tasks for this template (on the page with leetcode problems there is a filter by tags, you need to select the desired tag, for example “Two pointers” or “Sliding window”, etc.) and solve as many tasks as necessary to pin this topic.
  5. The fifth and most important tip is practice, practice and practice again, at the beginning I wanted to cry every time from my stupidity, because I couldn’t solve even simple problems and this is not an exaggeration, the phrase “how stupid I am” did not leave my head the first few months and even after solving 600 problems, there are still moments when self-esteem drops if you failed to solve some problem, especially if it turned out to be very easy to solve, but what is important is that with each solved problem you will become better about yourself .

Minus of the litcode decided on this platform, where tasks are given one after another, starting with the easy ones and repeating already solved problems in order to consolidate them. There is an explanation of different topics, after solving a problem you can see how others solved it, which is very useful, because… you see different approaches to solving the same problem.

FAQ

  1. What to do if you can’t solve the problem? If after 30-40 minutes you haven’t been able to solve the problem, then look at the solution, try to find a video solution to this problem, once you’ve watched and sorted it out, try solving it again, if it doesn’t work, watch it again and so on in a circle. From time to time, return to old problems and solve them again, especially if solving a problem was difficult for you. Sometimes I solved the same problem 10-15 times, or even more
  2. How many problems do you need to solve in order to start applying for vacancies? Everything is individual, I solved several problems every day for six months (on my own or with the help of a video), solved about 300 problems, and only at that moment did I feel the ground under my feet, and only felt confidence after solving about 400-500 problems. For some, 100-200 tasks are enough, unfortunately I’m not one of them.
  3. Which programming language should I choose to solve problems? In short – Python. I started solving in php, then switched to go, then started solving in java and finally after watching the video I decided to try python and have been using this language ever since. Java – you waste time on large constructions, for example – List items = new ArrayList<>();
    PHP – I was confused about function arguments, it was inconvenient to write in general, although I write almost all the time in this language Go – there are few built-in functions, even min/max, now there are, but then they weren’t, you also need to convert int to float and back, you waste extra time, although the code is predictable. Python is a concise code, there are many built-in functions that help solve problems (Counter, defaultdict, divmod, lambda, etc.), you spend time on solving the problem, and not on typing, etc., the speed is higher interview is very important.
  4. How to find time for tasks?
    In my case, I tried to solve 2 tasks a day, one task before I started work and a second task after work. On the weekends, I spent more time, watched videos, read articles, tried to solve more problems, and also tried to re-solve old problems in order to consolidate the topic and task.
  5. Do I need to buy leetcode premium?
    The most useful thing about premium is that you can see which companies gave this or that task. If you are preparing for a specific company, then I recommend it, otherwise the free version is enough, because a video explanation of the task can be found on the Neetcode channel (link below), etc.
  6. Is it worth buying access to educative.io?
    I saw a lot of recommendations for the Grokking Coding Interview Patterns course from educative, but I didn’t find this course very useful, the only thing I liked was the visual explanation, but in my opinion it’s better to watch the video on YouTube
  7. Is it worth buying access to algoexpert.io?
    In my opinion, a very useful resource, for each task there is a detailed explanation, almost every video is 30-50 minutes long. The site constantly runs different promotions and you can grab all the courses for a year for $99, reasonable price, nice site, a lot of test cases for tasks and the editor itself is nice and convenient

A story about how I solved more than 600 leetcode problems in a year 1

Result

  1. I achieved my initial goal, for which I started solving algorithms – passing a coding interview, one of the stages that is mandatory in FAANG companies, has already been completed in several companies and, most importantly, now there is no fear of this stage.
  2. I began to understand data structures more deeply; before I had no idea what a heap was, but now I have a complete understanding of this structure, as well as other structures.
  3. In the process of working, I began to look at the code a little differently, in some places you see that you can use more memory and reduce time complexity, and in other places it’s the other way around.
  4. Last, but not least, fitness for the brain has moved from the level of “I don’t want to, I won’t” to the level of “I want to solve problems every day”

useful links

  1. Perhaps most useful channelwhere a person explains the problem and solution in an accessible form.
  2. Same a lot of useful videos with explanations of different data structures.
  3. Explains data structures, tasks on the board.
  4. insidecode
  5. geekific
  6. MichaelMuinos
  7. NickWhite
  8. Cracking FANG

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *