LeetCode is the platform that most people choose to use when practicing interview-style data structure and algorithm questions. Whether you’re trying to pass LeetCode-style interview problems for big tech companies or trying to do LeetCode for fun, starting to solve problems on LeetCode as a beginner is a difficult task.
In this article, we will go over some of the tips and tricks to help you land software engineering jobs at FAANG and Big Tech. We will discuss how a beginner can start coding on LeetCode for interview preparation, where a beginner can start improving on LeetCode, and how long problems on LeetCode should take to complete.
How Does a Beginner Start Coding in LeetCode?
Solving LeetCode questions (even the questions labeled easy) is a difficult task for many beginners because of the amount and complexities of the prerequisites.
To begin solving LeetCode problems as a beginner, you’ll need a strong understanding of a programming language and its data structures. In addition, you’ll need to be able to implement popular algorithms in that programming language.
This is equivalent to 2 or 3 courses at university (intro to Computer Science, Data Structures, and Algorithms) where the LeetCode prerequisite is to score 95%+ minimums in each class for “As” or “A-plus”. Otherwise, generally speaking, if you’re getting lower than a B as grade marks, you probably won’t have a working use of the material you learned within the classes.
If you don’t have the strongest fundamentals, don’t let that discourage you. The topics you need to understand in terms of data structures include Arrays, Stacks, Queues, Linked Lists, Hash Tables (hash maps and hash sets), Trees (binary and n-ary), Graphs (directed and undirected), and Tries.
The most important algorithms you would need to study include Quick Sort, Merge Sort, Binary Search, Depth-first Search (DFS), Breadth-first Search (BFS), and Pre/In/Post order traversals.
For those of you who want a stronger primer into data structures and algorithms, watching MIT’s 6.006 Fall 2011 Introduction To Algorithms Lecture series on YouTube is strongly recommended. These video lectures are beneficial for topics you struggle with at a high-level.
Once you have the prerequisite knowledge understood on a functional level (meaning being able to rewrite/implement the data structures and algorithms in a programming language of your choice), you should be able to start completing LeetCode questions that are labeled “easy.”
Can A Beginner Start With LeetCode?
Previously in the article, we’ve discussed the prerequisite information that’s required to be understood in order to start solving LeetCode problems. But, is there a way to start practicing with LeetCode as a beginner before fully understanding all of the fundamentals of data structures and algorithms?
A beginner can start practicing on LeetCode without fully understanding the fundamentals of data structures and algorithms by focusing on learning instead of completing LeetCode problems. The moment you get stuck, look up the answers to the problem, understand the intuition, and document it.
This means that as long as you have a basic understanding of a programming language, you can start trying to complete LeetCode problems. I recommend starting with “easy” labeled questions on either the “Top Interview Questions” list or the “Top 100 Liked Questions” list.
To research a problem’s solution, you can either go into the discuss tab and try to find a helpful post that explains the problem’s intuition in detail or you can search the problem name in YouTube if you prefer video explanations instead. The LeetCode YouTube community is big enough now that most relevant LeetCode questions have solution explanations free on YouTube.
Note: If you pay for LeetCode premium, you get access to a “Solution Tab” on the problem page for the most relevant problems which could be helpful as well. In my experience, it’s been beneficial to buy LeetCode premium when I was grinding through LeetCode problems and preparing for my coding interviews at “Big Tech”. This is not a sponsored review or anything, just my personal opinion.
With this approach, it is highly suggested that you do not memorize solutions and instead understand the intuition so you can solve variations of the problem with different inputs and constraints.
Where Do I Start With LeetCode?
In the previous section, we covered two lists that LeetCode has called the Top Interview Questions and Top 100 Liked Questions lists. While the two lists are decent for practice, better lists exist if you’re trying to practice over a larger breadth of problems.
If you’re starting coding on LeetCode as a beginner, you can try completing easy questions from The Top Interview and Top 100 Liked Questions lists before moving onto other lists tailored towards better breadths of question topics and complexities like within the blind75 and neetcode150 lists.
How Long Should LeetCode Problems Take to Complete?
LeetCode problems are labeled (in terms of difficulty) either easy, medium, or hard. LeetCode “easy” should take about 5~ minutes, LeetCode “medium“ about 15~ minutes, and LeetCode “hard“ about 30~ minutes. These labels will generally depict how long it should take to complete and how intensive a LeetCode problem is.
Keep in mind that these are general guidelines for fair interview problems. It’s important to mention that all problems don’t fit this time guideline.
Some of the easy questions on LeetCode could take 30 minutes because they require understanding a specific trick and some of the hard problems can take 10 minutes because there’s a simple solution. The difficulty labels are subjective at the end of the day.
How Long Should an Easy LeetCode Problem Take to Complete?
An easy LeetCode question should take roughly 5 minutes to complete if you understand the fundamentals of data structures and algorithms. Usually, easy problems only test basic data structures and algorithms on a basic level. This is the type of question that would be asked as a warmup.
Does LeetCode Have Beginner Problems?
A lot of people starting out with solving easy LeetCode problems (myself included at the time) often ask if LeetCode has any other beginner problems easier than easy.
The truth is that LeetCode’s easy problems are beginner problems. Often, if easy problems are difficult, it’s just pointing out a knowledge gap within your fundamentals of data structures and algorithms. That’s an opportunity to fill your gap and make other LeetCode problems easier over time.
How Long Should a Medium LeetCode Problem Take to Complete?
A medium LeetCode question should take roughly 15 minutes to complete if you understand the fundamentals of data structures and algorithms. Medium problems tend to involve solutions that involve multiple data structures and algorithms together. This is the popular interview question difficulty.
Note: If you’re preparing for interviews, medium-labeled LeetCode questions are the types of questions you’d want to practice the most. Interview problems from my experience tend to be variants of medium-difficulty questions on LeetCode. Sometimes the variations will turn a problem from an objective medium to an objective hard, as well.
How Long Should a Hard LeetCode Problem Take to Complete?
Hard LeetCode questions (which would be asked in interviews) should take roughly 30 minutes to complete if you understand the fundamentals of data structures and algorithms. Solutions to these types of problems tend to include multiple data structures and algorithms.
Note: For people who are studying LeetCode to prepare for interviews, it’s important to understand that not all hard-labeled LeetCode problems are going to be asked during interviews. Some of the problems are too hard and wouldn’t be considered. A probably might be considered “too hard” if it is mathematics-heavy, has a hard-to-understand description, or requires one domain-related “trick” in order to solve.