What I’ve Learned After One Month of Doing Leetcode / HackerRank Problems

Adrian Trujillo Duron
4 min readFeb 15, 2022

--

Photo by Lagos Techie on Unsplash

Most people looking for a Software Developer position are likely to know what sites like Leetcode and HackerRank are. A few months ago I didn’t. Recently I started preparing myself for taking on coding interviews and found out how helpful they can be to make this task easier. In this post I’ll talk about some of the things that I discovered or learned during this past month where I was “grinding” through problems.

Data Structures And Algorithms Are Key

Photo by Joshua Sortino on Unsplash

This sites are not a DSA course. If you have no preparation in this topic, I strongly recommend you to take a course intended to teach the basics in these subjects. The most important thing for you is to have a in-depth understanding of how these structures work and what they are best at.

Imagine you are doing some renovations at your house and need to insert a screw. You could use a hammer and use brute force to make the screw fit, it will not be efficient and may break some things but the work will get done. Instead if you use a screwdriver everything will run smooth. This same thing happens with Data Structures! They are just tools that can be used by developers for solving problems.

Don’t Continue Without Understanding

Photo by Zuzana Ruttkay on Unsplash

If you are investing your time solving this problems, make that investment count and extract as much learning as possible.

It’s completely okay for you to not know the answer to a question, if you can’t solve it refer to the question’s solution or discussion section and really dig into that solution. Understand why the top solution is the most correct and why the time and space complexity are that way.

Additionally, when you’re struggling with a question, don’t skip to the solution too quickly. Spend some time working on it, even if it takes you an hour to write a brute force solution with terrible time complexity.

Choose Wisely

Photo by Javier Allegue Barros on Unsplash

Let me tell you a little secret: You won’t do all of the problems.

The number of problems available is simply too big for you to solve all of them. Instead focus on the types of questions that stump you. You don’t need to know the exact solution, interviewers will often help you if you’ve made some progress and guide you towards the right solution, but you need to know the general direction of where the solution is.

After 20 practice questions, you should have a rough idea of where your strengths and weaknesses lie. Take the opportunity to level up your weakest areas and repeat! This may involve going back and brushing up concepts related to data structures and algorithms.

Learn Patterns

Photo by Clark Van Der Beken on Unsplash

My final recommendation for you is that you really don’t need to spend months grinding hundreds of questions in Leetcode and HackerRank. Memorizing the answers will only get you so far.

Instead try focusing on identifying patterns in the questions and learning these instead! Think of them as formulas you can use for solving many different problems instead of just knowing the concrete solution of one problem.

These patterns will also be aplicable in your job where you could use them to solve real problems. The best part is that these patterns are much more faster to learn that grinding through all of Leetcode.

--

--