How and why I did over 1000 Leetcode problems

Satvik Ramaprasad
7 min readJun 5, 2021

Last year, I solved around 1200 leetcode problems, most of InterviewBit and some GeeksForGeeks as part of interview/placement preparation. I have also interviewed with a handful of companies and I want to share some things that I have learnt from the experience.

Disclaimer: This is a highly opinionated post of my experience and what worked for me. Because everyone learns differently, my methods may not work for you.

If you are in a hurry, you can skip to the 3rd section.

The Awakening

When we were preparing for JEE, parents and teachers gave the impression that after we get into a good college we are set for life and like most people I believed that. Therefore I spent my first 3 years of college getting good grades, doing fun projects, exploring stuff etc. However, at the end of 3rd year, I had a rude awakening. I hadn’t paid much attention to placements and companies till then. I got to know that most companies don’t care much about what we did in college. Our grades, projects, knowledge doesn’t matter much to them. Largely, they want us to be able to code and have problem-solving ability. Only 3 courses — DSA, Operating Systems and Databases matter. In fact, FAANG companies mainly only asked DSA problems in their interviews and have almost complete disregard for whatever else is present in the resume.

The fact that companies seem to focus on problem-solving can be a good or bad thing depending on perspective. From a positive perspective, anyone can work hard and get better at problem-solving. Yes, you read that, it isn’t as hard as it looks.

So I got to know one more thing, something like 50% of all problems asked in an interview is directly available in leetcode. Around 30% of the problems are very similar or modifications of questions found on leetcode. Only like 20% of questions are actually new. And with enough preparation, you can solve them as well. These numbers are from my personal and peer’s experiences.

That is why I decided to buckle up and embark on my journey to solve complete leetcode.

Why do companies focus on problem-solving?

I think it is important to understand why companies do their interviews the way they do them. So, the fact is that the big tech companies need to hire a lot of candidates. They also interview and hire globally. Their candidates and interviewers have very varied experience and knowledge. Therefore there is a need for a standardized interview process. The best that the industry has found is testing for coding skills and problem-solving ability. They believe that if the new hires are able to solve problems, they can learn and do anything.

In my opinion, smaller and mid-sized companies should hire differently. However, most of them seem to be copying their big counterparts.

How did I get started?

I had a headstart, I knew C++ fairly well and I was strong with DSA concepts because my college course was very good. However, I didn’t have STL knowledge (C++ Standard Template Library) and I wasn’t familiar with interview-style questions. I recommend solving problems only after being familiar with a programming language and learning the basic DSA concepts.

I started solving with Python and then shifted to C++. If you haven’t picked a language yet, I recommend C++ or Python. I don’t recommend Java due to the verbose nature of the language. Fix a language and code only in that language.

That's it, I just started solving leetcode problems. I started solving the easy problems first. They teach STL skills and give confidence. They also teach some simple tricks which can be combined to solve medium and harder problems.

I spent like 8 hours a day on leetcode. It went slow for a few days but soon I was able to solve with an average throughput of 10 problems a day. On some good days, I even solved 30 problems. How was this possible? I followed some principles which might help you do the same.

Principle 1: Solve every problem

There are so many easy leetcode problems that anyone can solve. Do NOT skip over them. Solve them as fast as you can and move forward. And by solving, I mean actually writing the code and getting all test cases passed.

Principle 2: Read Solution + Discussion

Wrote code on your own and got all test cases passed? Congrats! However, that is not the end, it is very important to read the solution and discussions. More often than not there will be more than one approach to solve the problem. It is important to understand all the approaches.

Leetcode discussion community is very good. Sort by most voted and pick any of the top few answers. Make sure you check out their code as well. The top coders write code very elegantly. There is a lot to learn from them even if you get the solution. Also reading the explanation will give you ideas on how to explain in the interview.

Principle 3: Do not spend more than 5–10 minutes thinking

This might be a controversial opinion. According to me, you will only have a maximum of 10 minutes in an online test to think of a solution and less than 20 minutes to implement it. In an interview, you will have even less time as you will need to explain your approach, code and dry run etc. So if in the actual test you have less time, you should prepare accordingly.

What I did was this, after 5 minutes, I give up and check the solution. If I don’t understand the solution, I bookmark it as red and leave it. If I understand the solution, I bookmark it as yellow.

After a week or two, I come back and solve the yellow ones. This time I try to recollect the solution and solve it myself. If I fail, then I read the solution again and come back later. Most of the times I succeeded to recollect the solution. This is extremely effective because it will feel like I got the solution myself and I would feel confident I can solve similar questions now.

Some advantages of this principle are:

  1. You didn't spend too much time “thinking”
  2. You understood the solution fast, it feels like progress
  3. If you recollect and implement it later, the concept will be ingrained in the mind
  4. Throughput — number of problems solved / day will be high
  5. Overall morale will be good because you are not spending time stuck

Principle 4: Solve problems of the same topic together

There are 2 approaches to solving problems. I practised both.

Mix different topics and solve them

This has the advantage of not getting bored. Moreover, an important part of problem-solving is identifying the topic.

Solve problems of the same topic together

This can get boring but has some advantages from the learning perspective.

  1. High throughput — e.g. if you have already solved a binary search problem, you can solve similar binary search problems fast.
  2. Pattern recognition — e.g. you will be able to recognize the different types of DP problems.
  3. Confidence and Morale — even if you take help for the first type of problem, you are able to solve the next type of problem quickly.

Leetcode suggests similar problems after successfully solving a problem. I have found these suggestions to be very accurate and helpful.

Leetcode Similar Problems

Principle 5: Practice, Practice, Practice!

There is no shortcut, I practised a lot. I regularly solved some important problems I have already solved just to make sure they are at my fingertips.

How many problems should I target?

In my experience after solving 300–500 problems, you should be able to clear interviews in very good companies. If you solve 1000+ problems, you can clear any company!

Leetcode has a difficulty ratio of 1:2:1 for easy, medium and hard problems. I find the hard problems quite hard. They are rarely asked in an interview, so it is okay to skip them and just solve the popular hard questions. I solved the problems in the ratio of 2:4:1.

Don’t worry too much about what problems you solve but make sure you do solve a good number of medium problems because they are the ones that are regularly asked in an interview.

Leetcode Contests

After getting confidence in solving problems, I started doing leetcode contests. This is important because you will have pressure and time constraint in a coding round. So leetcode contests can help simulate that.

Bonus Giveaway

I wanted to give back to the community, so I made 2 things that can help prepare better.

Leetcode Preparation Sheet

This sheet can help you prepare more effectively. It sorts the question based on the popularity and quality of the question. Check the READ ME sheet to understand how to use the sheet. This was prepared by my junior Saiakash Konidena with my guidance.

Link: Leetcode Preparation Sheet

Leetcode Preparation Google Sheet

Interview Bit Chrome Extension

InterviewBit has an excellent list of curated problems. I highly recommend solving them especially if you have less time. However, they have a very poor question and solution description. Even their user interface is subpar. Therefore I built an extension that maps interview bit questions to leetcode ones.

Link: Chrome Webstore

Leetcode Links in InterviewBit site

Conclusion

That's it! This journey was a rollercoaster ride and it took over a year to complete. However, it is completely worth it. Problem-solving rounds are present even for higher positions and therefore this skill will help in the long run.

These were some of the principles that I developed while I was preparing for coding rounds. I am planning to write a blog post on how to prepare for an interview and some important tips. Stay tuned!

If you would like to do a mock interview with me, register for one at https://proxyprep.tech/

--

--