How to start solving problems with LeetCode [2023 Edition]

Mykhailo Kushnir
Level Up Coding
Published in
4 min readMar 9, 2023

--

Photo by Jason Strull on Unsplash

With the rapidly changing landscape of the job market, it is a good idea to keep problem-solving skills fresh. LeetCode has been a standard platform for practising these skills for a while now. As we enter 2023, it is a good time to reassess our approach to solving LeetCode problems and incorporate new strategies into our practice.

In this article, I will cover some well-established approaches to tackling LeetCode problems, as well as introduce new techniques and tools that can help you deal with those difficult tasks. Whether you are a seasoned LeetCode veteran or just getting started, this guide will provide valuable insights and tips to help you approach LeetCode problems confidently and easily.

You might need a plan

It might appear daunting for somebody entering the LeetCode for the first time. Many problems, most of which are related to algorithms rarely used in enterprise software development. That’s where study plans come to help. Here are the most known ones:

  1. 14 days to study on LeetCode
  2. LeetCode 75
  3. The Tech Interview Handbook study plan
  4. Mocked assessment

Following a plan, controlling your progress and capitalising on learned concepts are easier. The plans above are structured in a way that earlier tasks “prepare” you for the ones at the end, so it can make your learning curve a bit less steep.

What to do when you are stuck?

…And believe me, you will be. Unless you have done competitive programming since the age of six, problems on LeetCode will get you one way or another. Here’s my list of helpful links to pull yourself out of a mire by your own hair:

  1. Review the “Related Topics” under a problem. It often gives some free hints on what algorithms could be used to solve the task.
Related topics are at the bottom of the page

2. Follow the tips from Regis AI bot. It can give hints without giving away a solution. After installation, such an option would be available in the “Right Click” menu on LeetCode.

Here’s how problem hints look like

3. Review some of the NeetCode tutorials on YouTube. He has shown an organized approach to most common LC problems, and his videos are easy to follow. All solutions are explained in a way that would be possible to remember. In comparison, solutions provided in the discussion section of LC are often “you just have to know” style.

How to remember all the learned stuff?

At some point, you’ll be cracking most of the problems in your head, but keeping that flow state for a long time is difficult. Here’s my list of tips that helped me understand a depth-first search algorithm:

Memorizing programming algorithms like Depth First Search (DFS) requires a combination of understanding the underlying concepts and practising implementing them. Here are some tips that can help you memorize DFS:

  1. Understand the algorithm: Before attempting to memorize DFS, ensure you understand the algorithm and its purpose. DFS is a graph traversal algorithm that explores as far as possible along each branch before backtracking. This means it starts at the root node and explores as far as possible along each branch before backtracking.
  2. Break it down into steps: Break down the algorithm into smaller steps and understand each individually. For example, if you need to learn how to do DFS without recursion, learn the recursive version and then the common approach of mitigating recursion through the stack.
  3. Practice coding: Practice coding the algorithm in different scenarios. This will help you develop a better understanding of the algorithm and its implementation. Implementing the algorithm will also help you memorize it, as you will be able to understand how it works.
  4. Use visual aids: Use diagrams and visual aids to help you understand and remember the algorithm. Here’s a useful tool.
  5. Repeat and revise: Practice implementing the algorithm regularly and revise it often. Repetition will help you memorize the algorithm and recall it more easily when needed.

Summary

Having a plan and tools to work with LeetCode helps to make your way to new offers and job ambitions. I hope this article was useful to you on that behalf. Let me know if you have other tools or tricks for algorithmic programming.

--

--