So you’ve heard about LeetCode but aren’t sure where to start? Or maybe you’ve opened a problem, stared at it for 30 minutes, and closed the tab? You’re not alone – everyone starts there.

This guide walks you through everything step by step: what LeetCode actually is, how to use it, what the difficulty levels mean, and exactly which problems to solve first. No prior algorithm experience required.

New to Java? Check out the Java Guide to learn the language alongside this guide.

What Is LeetCode?

LeetCode is a website with 3000+ coding puzzles. Each puzzle gives you a problem, and you write code to solve it. Think of it like a gym for your brain – instead of lifting weights, you’re training your problem-solving muscles.

People use LeetCode for:

  • Getting a tech job – companies like Google, Meta, Amazon, and Microsoft ask LeetCode-style questions in interviews. It’s the standard.
  • Learning algorithms – the problems teach you patterns (sorting, searching, graph traversal) that come up everywhere in real software.
  • Competitive programming – if you want to compete in ICPC, Codeforces, or AtCoder, LeetCode is a great starting point.

What makes it different from tutorials? LeetCode doesn’t teach you theory then quiz you. It throws you into a problem, and you figure out which technique applies. That’s exactly what interviews and real engineering feel like.

How the Platform Works

What a Problem Looks Like

Every LeetCode problem has four parts:

Part What It Tells You Why It Matters
Description The problem statement Read carefully – every word matters
Examples Sample input → expected output Work through these by hand before coding
Constraints How large the input can be Tells you which approaches are fast enough
Follow-up An optional harder challenge Ignore this at first, come back later

Your First Submission

Here’s exactly what happens when you solve a problem:

  1. Pick a language — select Java in the editor (new to Java? See the Java Guide)
  2. Write your code in the browser editor — usually inside class Solution { ... }
  3. Click “Run” — tests your code against the visible examples
  4. Click “Submit” — tests against hundreds of hidden test cases
  5. Get a verdict:
Verdict What It Means What to Do
Accepted (AC) Your code is correct and fast enough Celebrate, then read other solutions
Wrong Answer (WA) Incorrect output on some test case Check edge cases and logic
Time Limit Exceeded (TLE) Too slow You need a faster algorithm
Memory Limit Exceeded (MLE) Uses too much memory Optimize your data structures
Runtime Error (RE) Crash (NullPointerException, out of bounds, etc.) Check array bounds and null checks

Don’t be discouraged by WA or TLE – they’re normal, even for experienced programmers. Each failed submission teaches you something.

The Secret Cheat Sheet: Reading Constraints

Here’s something most beginners miss: the constraints section tells you which algorithm to use. The input size directly determines what time complexity is acceptable:

Input size n Target Complexity What This Means Typical Approaches
$n \le 10$ $O(n!)$ or $O(2^n)$ Try everything Brute force, backtracking
$n \le 20$ $O(2^n)$ Subsets / states Bitmask DP
$n \le 500$ $O(n^3)$ Triple loop is OK Floyd-Warshall, matrix DP
$n \le 5{,}000$ $O(n^2)$ Double loop is OK DP, two pointers
$n \le 10^5$ $O(n \log n)$ Sort + scan Sorting, binary search
$n \le 10^6$ $O(n)$ Single pass HashMap, sliding window
$n \le 10^9$ $O(\log n)$ No array at all Binary search on answer, math

Example: If a problem says $1 \le n \le 10^5$, an $O(n^2)$ solution will be too slow ($10^{10}$ operations). You need $O(n \log n)$ or better – think sorting or binary search.

Difficulty Levels Explained

LeetCode marks every problem as Easy, Medium, or Hard. Here’s what that actually means in practice:

Easy – “Learn the building blocks”

You need one technique and the path is usually obvious. If you know the right data structure, the code writes itself.

You’ll use: Arrays, HashMap, basic string operations, simple loops.

Examples (try these first!):

Benchmark: Can you solve a new Easy in 10-15 minutes? If not, keep practicing at this level. There’s no shame in it – foundations matter.

Medium – “This is where interviews live”

You need to recognize a pattern and sometimes combine two techniques. The approach isn’t always obvious – that’s the challenge.

You’ll use: BFS/DFS, dynamic programming, sliding window, binary search, graphs.

Examples:

  • 200. Number of Islands – “I see a grid, I need to explore connected regions.” DFS or BFS.
  • 322. Coin Change – “Minimize something with choices at each step.” Classic DP.
  • 146. LRU Cache – Combine a HashMap with a linked structure. Design problems test your ability to compose data structures.

Benchmark: Solve in 20-30 minutes. Most of your practice time should be here.

Hard – “Come back later”

Multiple techniques, tricky edge cases, or a key insight that’s genuinely difficult to find. These test mastery, not learning.

Examples:

Don’t start here. Seriously. Come back after you’re comfortable solving Medium problems. Hard problems build on patterns you learn from Medium.

Your Roadmap: From Zero to Interview-Ready

Don’t try to learn everything at once. Follow these phases in order – each one builds on the last.

Phase 1: Foundations (Weeks 1-4) – “Get comfortable”

Goal: Solve Easy problems without getting stuck. Build muscle memory with basic data structures.

What to learn:

  • Arrays and strings — looping, indexing, charAt, StringBuilder
  • Hash maps — the single most useful data structure in interviews (HashMap, HashSet)
  • Linked listsListNode and updating next references (feels weird at first, that’s normal)
  • Stacks and queues — use Deque / ArrayDeque for stack; Queue for BFS
  • Basic recursion – “solve a smaller version of the same problem”

Learning Java alongside? Work through Language Basics and the Collections Quick Reference in parallel.

Start with these 10 problems (in order):

# Problem Topic
1 Two Sum HashMap
217 Contains Duplicate HashSet
242 Valid Anagram HashMap / Sorting
20 Valid Parentheses Stack (Deque)
206 Reverse Linked List Linked List
21 Merge Two Sorted Lists Linked List
121 Best Time to Buy and Sell Stock Array / Greedy
70 Climbing Stairs Basic DP
104 Maximum Depth of Binary Tree Tree / Recursion
226 Invert Binary Tree Tree / Recursion

Phase 2: Core Patterns (Weeks 5-12) – “Learn to recognize”

Goal: When you see a new problem, you can say “This looks like a sliding window problem” or “This is DFS on a grid.” Pattern recognition is the core skill.

The 9 patterns that cover 90% of interview questions:

Pattern Key Problems Template
Sliding Window 3, 76, 424, 567 String Processing
Two Pointers 15, 11, 167, 42 Array & Matrix
Binary Search 33, 34, 153, 875 Search
BFS / DFS 200, 133, 695, 994 BFS, DFS
Dynamic Programming 70, 198, 322, 300 DP
Backtracking 46, 78, 39, 79 Backtracking
Graphs 207, 210, 743, 261 Graph
Heap / Priority Queue 215, 347, 295 Heap
Monotonic Stack 84, 739, 496 Stack

How to study each pattern:

  1. Read the template page linked above – understand the general approach
  2. Solve 3-5 problems in that category
  3. Stuck for 20+ minutes? That’s OK. Read the editorial, understand it, then re-solve from scratch the next day without looking. This is where real learning happens.
  4. Move to the next pattern once you can solve new problems in the category without hints

Phase 3: Competition Readiness (Weeks 13+) – “Get fast”

Goal: Solve 2-3 Medium problems in 60 minutes under time pressure.

How to practice:

  • Timed sessions – set a 60-minute timer, pick 2 random Medium problems
  • Weekly contests – LeetCode runs one every Sunday (4 problems, 90 minutes). Just try it – you’ll probably only solve 1-2 at first, and that’s fine.
  • Retry list – every problem you couldn’t solve goes on a list. Revisit it weekly.
  • Codeforces Div 2 – problems A and B are comparable to LeetCode Easy/Medium, but with a competitive twist

Advanced topics (when you’re ready):

Topic What It’s For Template
Segment Tree / BIT Range queries and updates Data Structures
Topological Sort Ordering tasks with dependencies Graph
Union Find (DSU) Grouping connected components Graph
Bit Manipulation Power-of-2 tricks, subset enumeration Math & Bit
Advanced DP Bitmask DP, digit DP, tree DP DP

The Must-Know Problem Lists

Don’t try to do all 3000+ LeetCode problems. These curated lists are the most efficient paths to interview readiness — start with Blind 75 for the core, then NeetCode 150 for full pattern coverage.

List Problems Best For
Blind 75 75 First pass — covers every major category
NeetCode 150 150 Blind 75 + 75 more — deeper practice per pattern
NeetCode 250 250 After 150 — extra hard problems and company tags

Blind 75 – The Essential Core

The original “must-do” list. 75 problems that cover every major category with no fluff. If you deeply understand each solution (not just memorize it), you’re ready for most interviews.

Category Count Problem Numbers
Array & Hashing 9 1, 49, 238, 128, 217, 242, 347, 271, 659
Two Pointers 3 15, 11, 125
Sliding Window 4 3, 424, 76, 567
Stack (Deque) 1 20
Binary Search 2 153, 33
Linked List 6 206, 21, 141, 143, 19, 23
Trees 11 226, 104, 100, 572, 102, 297, 230, 98, 235, 105, 124
Heap 1 295
Backtracking 2 39, 79
Graphs 6 200, 133, 417, 207, 323, 261
1-D DP 10 70, 198, 213, 5, 647, 91, 322, 139, 300, 152
2-D DP 2 62, 1143
Greedy 2 53, 55
Intervals 4 57, 56, 435, 252
Math & Bit 3 191, 338, 268

NeetCode 150 – The Full Interview Roadmap

NeetCode 150 is Blind 75 plus 75 more problems in the same pattern-based structure. On the official site it is described as “the perfect list for people already familiar with basic algorithms & data structures.”

Practice on NeetCode: neetcode.io/practice/neetcode150 · LeetCode list: problem-list/ebdgnf5s

Why NeetCode 150?

Value What You Get
Curated roadmap 18 categories in a logical study order — not a random grab bag
Pattern-first Each section drills one technique (sliding window, topo sort, interval DP, etc.)
Efficient scope 150 problems vs. 3000+ on LeetCode — quality over quantity
Progress tracking Track Easy / Medium / Hard completion on NeetCode
Video walkthroughs Free video solutions for every problem on the NeetCode YouTube channel
Maps to this blog Most categories link directly to our algorithm templates

Difficulty split: 28 Easy · 101 Medium · 21 Hard (150 total)

Follow the NeetCode Roadmap — work through categories top to bottom:

  1. Foundations — Arrays & Hashing → Two Pointers → Sliding Window → Stack → Binary Search
  2. Core structures — Linked List → Trees → Tries → Heap / Priority Queue
  3. Search & graphs — Backtracking → Graphs → Advanced Graphs
  4. Optimization — 1-D DP → 2-D DP → Greedy → Intervals → Math & Geometry → Bit Manipulation

When to start: Finish Phase 1–2 of the roadmap above (or complete Blind 75) before diving into NeetCode 150. You should already be comfortable with hash maps, basic recursion, and at least one traversal (BFS or DFS).

Category overview

Category Count Template on this blog
Arrays & Hashing 9 String Processing
Two Pointers 5 Array & Matrix
Sliding Window 6 String Processing
Stack (Deque) 6 Stack
Binary Search 7 Search
Linked List 11 Linked List
Trees 15 Trees
Heap / Priority Queue 7 Heap
Backtracking 10 Backtracking
Tries 3 Data Structures
Graphs 13 Graph, BFS, DFS
Advanced Graphs 6 Graph
1-D Dynamic Programming 12 DP
2-D Dynamic Programming 11 DP
Greedy 8 Greedy
Intervals 6 Greedy
Math & Geometry 8 Math & Geometry, Array & Matrix
Bit Manipulation 7 Math & Bit

Complete problem list (150)

Problems are listed in NeetCode roadmap order. Premium problems are marked with †.

Arrays & Hashing (9)

LC Problem
217 Contains Duplicate
242 Valid Anagram
1 Two Sum
349 Intersection of Two Arrays
128 Longest Consecutive Sequence
238 Product of Array Except Self
271 Encode and Decode Strings
49 Group Anagrams
347 Top K Frequent Elements

Two Pointers (5)

LC Problem
125 Valid Palindrome
167 Two Sum II
15 3Sum
11 Container With Most Water
42 Trapping Rain Water

Sliding Window (6)

LC Problem
121 Best Time to Buy and Sell Stock
3 Longest Substring Without Repeating Characters
424 Longest Repeating Character Replacement
567 Permutation in String
76 Minimum Window Substring
239 Sliding Window Maximum

Stack (6)

LC Problem
20 Valid Parentheses
155 Min Stack
150 Evaluate Reverse Polish Notation
739 Daily Temperatures
394 Decode String
853 Car Fleet

Binary Search (7)

LC Problem
704 Binary Search
74 Search a 2D Matrix
875 Koko Eating Bananas
153 Find Minimum in Rotated Sorted Array
33 Search in Rotated Sorted Array
981 Time Based Key-Value Store
4 Median of Two Sorted Arrays

Linked List (11)

LC Problem
206 Reverse Linked List
21 Merge Two Sorted Lists
143 Reorder List
19 Remove Nth Node From End of List
138 Copy List with Random Pointer
2 Add Two Numbers
141 Linked List Cycle
287 Find the Duplicate Number
146 LRU Cache
23 Merge k Sorted Lists
25 Reverse Nodes in k-Group

Trees (15)

LC Problem
226 Invert Binary Tree
104 Maximum Depth of Binary Tree
543 Diameter of Binary Tree
110 Balanced Binary Tree
100 Same Tree
572 Subtree of Another Tree
235 Lowest Common Ancestor of a BST
102 Binary Tree Level Order Traversal
199 Binary Tree Right Side View
1448 Count Good Nodes in Binary Tree
98 Validate Binary Search Tree
230 Kth Smallest Element in a BST
105 Construct Binary Tree from Preorder and Inorder
124 Binary Tree Maximum Path Sum
297 Serialize and Deserialize Binary Tree

Tries (3)

LC Problem
208 Implement Trie (Prefix Tree)
211 Design Add and Search Words Data Structure
212 Word Search II

Heap / Priority Queue (7)

LC Problem
703 Kth Largest Element in a Stream
1046 Last Stone Weight
973 K Closest Points to Origin
215 Kth Largest Element in an Array
621 Task Scheduler
355 Design Twitter
295 Find Median from Data Stream

Backtracking (10)

LC Problem
78 Subsets
39 Combination Sum
46 Permutations
90 Subsets II
40 Combination Sum II
79 Word Search
131 Palindrome Partitioning
17 Letter Combinations of a Phone Number
51 N-Queens
22 Generate Parentheses

Graphs (13)

LC Problem
200 Number of Islands
133 Clone Graph
695 Max Area of Island
417 Pacific Atlantic Water Flow
130 Surrounded Regions
994 Rotting Oranges
286 Walls and Gates
207 Course Schedule
210 Course Schedule II
684 Redundant Connection
323 Number of Connected Components
261 Graph Valid Tree
127 Word Ladder

Advanced Graphs (6)

LC Problem
332 Reconstruct Itinerary
1584 Min Cost to Connect All Points
743 Network Delay Time
778 Swim in Rising Water
269 Alien Dictionary
787 Cheapest Flights Within K Stops

1-D Dynamic Programming (12)

LC Problem
70 Climbing Stairs
746 Min Cost Climbing Stairs
198 House Robber
213 House Robber II
5 Longest Palindromic Substring
647 Palindromic Substrings
91 Decode Ways
322 Coin Change
152 Maximum Product Subarray
139 Word Break
300 Longest Increasing Subsequence
416 Partition Equal Subset Sum

2-D Dynamic Programming (11)

LC Problem
62 Unique Paths
1143 Longest Common Subsequence
309 Best Time to Buy and Sell Stock with Cooldown
518 Coin Change 2
494 Target Sum
97 Interleaving String
329 Longest Increasing Path in a Matrix
115 Distinct Subsequences
72 Edit Distance
312 Burst Balloons
10 Regular Expression Matching

Greedy (8)

LC Problem
53 Maximum Subarray
55 Jump Game
45 Jump Game II
134 Gas Station
846 Hand of Straights
1899 Merge Triplets to Form Target Triplet
763 Partition Labels
678 Valid Parenthesis String

Intervals (6)

LC Problem
57 Insert Interval
56 Merge Intervals
435 Non-overlapping Intervals
252 Meeting Rooms
253 Meeting Rooms II
2402 Meeting Rooms III

Math & Geometry (8)

LC Problem
48 Rotate Image
54 Spiral Matrix
73 Set Matrix Zeroes
202 Happy Number
66 Plus One
50 Pow(x, n)
43 Multiply Strings
2013 Detect Squares

Bit Manipulation (7)

LC Problem
136 Single Number
191 Number of 1 Bits
338 Counting Bits
190 Reverse Bits
268 Missing Number
371 Sum of Two Integers
7 Reverse Integer

How to use NeetCode 150 effectively

  1. Follow the roadmap order — don’t skip ahead to DP before you can do trees comfortably.
  2. Pair with templates — read the matching template page before each category.
  3. Watch the video after you try — attempt the problem for 20–25 minutes first, then watch the NeetCode explanation.
  4. Track on NeetCode — the practice page shows your Easy/Medium/Hard progress bar.
  5. Revisit weak categories — if Graphs feels hard, loop back to BFS/DFS templates before Advanced Graphs.

More lists on NeetCode: Blind 75 · NeetCode 250 · How to use NeetCode effectively

Practical Tips That Actually Help

When You’re Stuck (This Will Happen a Lot)

Getting stuck is normal and part of the process. Here’s a concrete checklist:

  1. Re-read the constraints – they tell you which algorithm to use (see the cheat sheet above)
  2. Draw it out – literally use pen and paper. Trace through the example step by step.
  3. Ask yourself: “What data structure would make this easier?”
    • “I need instant lookup” → hash map
    • “I need sorted order” → heap, BST, or set
    • “I need to undo / go back” → stack
    • “I need to process in order” → queue
  4. After 25 minutes, read the editorial. Don’t waste 2 hours staring. Learning from solutions is still learning.
  5. The crucial step: Re-solve the problem the next day without looking at the solution. This is where the learning actually sticks.

The 5 Most Common Beginner Mistakes

Mistake Why It Hurts The Fix
Jumping to Hard problems You lack the patterns that Hard problems build on Complete Phase 1 and 2 first
Memorizing code You can reproduce one solution but can’t adapt to variants Focus on why the approach works, not the exact code
Never timing yourself Interviews have time limits; untimed practice doesn’t prepare you Set a timer. Every time.
Only solving comfortable categories Your weak areas stay weak Track which categories you struggle with and prioritize them
Ignoring edge cases Costs you “Accepted” on problems you otherwise solved Always test: empty input, single element, all same values, maximum input size

Which Language Should I Use on This Blog?

Language Best For Trade-offs Guide
Java (recommended here) Interviews, readable typed code, strong collections API More boilerplate than Python; use HashMap, Deque, PriorityQueue Java Guide
Python Rapid prototyping, short syntax Slower runtime; may TLE on tight constraints

Bottom line: All solutions on this blog are in Java. Pick Java in the LeetCode language dropdown and use the Java Guide while you learn. In real interviews, the algorithm matters more than the language — but stick to one language until patterns feel automatic.

Getting the Most Out of LeetCode

Feature What It Does When to Use It
Study Plans Daily curated problem sets Great for building consistency — or use NeetCode 150
Weekly Contests 4 problems, 90 min, every Sunday Start joining once you can solve Medium problems
Discussion Tab Other people’s solutions Read after every problem – even ones you solved
Company Tags (Premium) Which companies ask which problems Useful when preparing for a specific interview
Playground Quick code sandbox Test snippets without creating a submission

What Comes After LeetCode?

Once you can consistently solve 2-3 Medium problems in a timed session:

  1. LeetCode Weekly Contests – measure yourself against others
  2. Codeforces Div 2 – problems A and B are similar difficulty, but the contest format is different
  3. AtCoder – exceptional problem quality, especially for dynamic programming
  4. Books to level up:
    • Competitive Programming 3 by Steven Halim
    • Guide to Competitive Programming by Antti Laaksonen

Remember: the goal isn’t to solve every problem. It’s to recognize patterns quickly and write correct solutions under pressure.


Resource Description
Java Guide Learn Java for LeetCode — intro, learning path, language basics
LeetCode Templates Index All algorithm pattern templates on this blog
NeetCode 150 (official) Curated 150-problem interview roadmap with progress tracking
All Solved Problems Every problem solved on this blog, with links
Java Collections Quick Reference Fast API lookup while coding