The Top Interview 150 LeetCode List
Top Interview 150: the official interview-preparation list, a hundred and fifty problems covering every data structure and technique a technical screen is likely to reach for.
- 150 problems
- 40 Easy
- 92 Medium
- 18 Hard
- 21 patterns
Where this list comes from
The Top Interview 150 is not ours. It is a published selection that people work through by name, and we reproduce it here by problem number, in the order the list itself uses. What we add is the solution: of the 150 entries below, 150 carry a complete Python solution with a worked example and its time and space complexity.
The published list names 150 entries. All 150 resolve to a problem in this library and are listed below.
Every count on this page is computed from what the page renders, so the number in a heading is the number of rows under it. Nothing is padded to make a title's number come out right — that would be wrong in a way anyone who knows the list would spot in seconds.
All 150 problems, grouped by pattern
Each group is the pattern that most specifically solves those problems, so the list can be worked through a technique at a time instead of a problem at a time. Groups appear in the order the list itself introduces them.
Two Pointers (14)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 88 | Merge Sorted Array | Easy | Array, Two Pointers, Sorting |
| 27 | Remove Element | Easy | Array, Two Pointers |
| 26 | Remove Duplicates from Sorted Array | Easy | Array, Two Pointers |
| 80 | Remove Duplicates from Sorted Array II | Medium | Array, Two Pointers |
| 189 | Rotate Array | Medium | Array, Math, Two Pointers |
| 151 | Reverse Words in a String | Medium | Two Pointers, String |
| 28 | Find the Index of the First Occurrence in a String | Easy | Two Pointers, String, String Matching |
| 125 | Valid Palindrome | Easy | Two Pointers, String |
| 392 | Is Subsequence | Easy | Two Pointers, String, Dynamic Programming |
| 167 | Two Sum II - Input Array Is Sorted | Medium | Array, Two Pointers, Binary Search |
| 11 | Container With Most Water | Medium | Greedy, Array, Two Pointers |
| 15 | 3Sum | Medium | Array, Two Pointers, Sorting |
| 202 | Happy Number | Easy | Hash Table, Math, Two Pointers |
| 5 | Longest Palindromic Substring | Medium | Two Pointers, String, Dynamic Programming |
Sorting (5)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 169 | Majority Element | Easy | Array, Hash Table, Divide and Conquer +2 |
| 274 | H-Index | Medium | Array, Counting Sort, Sorting |
| 242 | Valid Anagram | Easy | Hash Table, String, Sorting |
| 49 | Group Anagrams | Medium | Array, Hash Table, String +1 |
| 56 | Merge Intervals | Medium | Array, Sorting |
Dynamic Programming (9)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 121 | Best Time to Buy and Sell Stock | Easy | Array, Dynamic Programming |
| 53 | Maximum Subarray | Medium | Array, Divide and Conquer, Dynamic Programming |
| 70 | Climbing Stairs | Easy | Memoization, Math, Dynamic Programming |
| 198 | House Robber | Medium | Array, Dynamic Programming |
| 120 | Triangle | Medium | Array, Dynamic Programming |
| 97 | Interleaving String | Medium | String, Dynamic Programming |
| 72 | Edit Distance | Medium | String, Dynamic Programming |
| 123 | Best Time to Buy and Sell Stock III | Hard | Array, Dynamic Programming |
| 188 | Best Time to Buy and Sell Stock IV | Hard | Array, Dynamic Programming |
Greedy (6)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 122 | Best Time to Buy and Sell Stock II | Medium | Greedy, Array, Dynamic Programming |
| 55 | Jump Game | Medium | Greedy, Array, Dynamic Programming |
| 45 | Jump Game II | Medium | Greedy, Array, Dynamic Programming |
| 134 | Gas Station | Medium | Greedy, Array |
| 135 | Candy | Hard | Greedy, Array |
| 452 | Minimum Number of Arrows to Burst Balloons | Medium | Greedy, Array, Sorting |
Math and Number Theory (8)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 380 | Insert Delete GetRandom O(1) | Medium | Design, Array, Hash Table +2 |
| 13 | Roman to Integer | Easy | Hash Table, Math, String |
| 12 | Integer to Roman | Medium | Hash Table, Math, String |
| 9 | Palindrome Number | Easy | Math |
| 66 | Plus One | Easy | Array, Math |
| 172 | Factorial Trailing Zeroes | Medium | Math |
| 50 | Pow(x, n) | Medium | Recursion, Math |
| 149 | Max Points on a Line | Hard | Geometry, Array, Hash Table +1 |
Prefix Sum (1)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 238 | Product of Array Except Self | Medium | Array, Prefix Sum |
Stack (8)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 42 | Trapping Rain Water | Hard | Stack, Array, Two Pointers +2 |
| 20 | Valid Parentheses | Easy | Stack, String |
| 71 | Simplify Path | Medium | Stack, String |
| 155 | Min Stack | Medium | Stack, Design |
| 150 | Evaluate Reverse Polish Notation | Medium | Stack, Array, Math |
| 224 | Basic Calculator | Hard | Stack, Recursion, Math +1 |
| 173 | Binary Search Tree Iterator | Medium | Stack, Tree, Design +3 |
| 918 | Maximum Sum Circular Subarray | Medium | Queue, Array, Divide and Conquer +2 |
Hash Map (7)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 58 | Length of Last Word | Easy | String |
| 6 | Zigzag Conversion | Medium | String |
| 68 | Text Justification | Hard | Array, String, Simulation |
| 383 | Ransom Note | Easy | Hash Table, String, Counting |
| 205 | Isomorphic Strings | Easy | Hash Table, String |
| 290 | Word Pattern | Easy | Hash Table, String |
| 1 | Two Sum | Easy | Array, Hash Table |
Trie (5)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 14 | Longest Common Prefix | Easy | Trie, Array, String |
| 208 | Implement Trie (Prefix Tree) | Medium | Design, Trie, Hash Table +1 |
| 211 | Design Add and Search Words Data Structure | Medium | Depth-First Search, Design, Trie +1 |
| 212 | Word Search II | Hard | Trie, Array, String +2 |
| 139 | Word Break | Medium | Trie, Memoization, Array +3 |
Sliding Window (5)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 209 | Minimum Size Subarray Sum | Medium | Array, Binary Search, Prefix Sum +1 |
| 3 | Longest Substring Without Repeating Characters | Medium | Hash Table, String, Sliding Window |
| 30 | Substring with Concatenation of All Words | Hard | Hash Table, String, Sliding Window |
| 76 | Minimum Window Substring | Hard | Hash Table, String, Sliding Window |
| 219 | Contains Duplicate II | Easy | Array, Hash Table, Sliding Window |
Matrix and Grid (11)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 36 | Valid Sudoku | Medium | Array, Hash Table, Matrix |
| 54 | Spiral Matrix | Medium | Array, Matrix, Simulation |
| 48 | Rotate Image | Medium | Array, Math, Matrix |
| 73 | Set Matrix Zeroes | Medium | Array, Hash Table, Matrix |
| 289 | Game of Life | Medium | Array, Matrix, Simulation |
| 909 | Snakes and Ladders | Medium | Breadth-First Search, Array, Matrix |
| 427 | Construct Quad Tree | Medium | Tree, Array, Divide and Conquer +1 |
| 74 | Search a 2D Matrix | Medium | Array, Binary Search, Matrix |
| 64 | Minimum Path Sum | Medium | Array, Dynamic Programming, Matrix |
| 63 | Unique Paths II | Medium | Array, Dynamic Programming, Matrix |
| 221 | Maximal Square | Medium | Array, Dynamic Programming, Matrix |
Union-Find (4)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 128 | Longest Consecutive Sequence | Medium | Union Find, Array, Hash Table |
| 200 | Number of Islands | Medium | Depth-First Search, Breadth-First Search, Union Find +2 |
| 130 | Surrounded Regions | Medium | Depth-First Search, Breadth-First Search, Union Find +2 |
| 399 | Evaluate Division | Medium | Depth-First Search, Breadth-First Search, Union Find +4 |
Other (2)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 228 | Summary Ranges | Easy | Array |
| 57 | Insert Interval | Medium | Array |
Linked List (15)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 141 | Linked List Cycle | Easy | Hash Table, Linked List, Two Pointers |
| 2 | Add Two Numbers | Medium | Recursion, Linked List, Math |
| 21 | Merge Two Sorted Lists | Easy | Recursion, Linked List |
| 138 | Copy List with Random Pointer | Medium | Hash Table, Linked List |
| 92 | Reverse Linked List II | Medium | Linked List |
| 25 | Reverse Nodes in k-Group | Hard | Recursion, Linked List |
| 19 | Remove Nth Node From End of List | Medium | Linked List, Two Pointers |
| 82 | Remove Duplicates from Sorted List II | Medium | Linked List, Two Pointers |
| 61 | Rotate List | Medium | Linked List, Two Pointers |
| 86 | Partition List | Medium | Linked List, Two Pointers |
| 146 | LRU Cache | Medium | Design, Hash Table, Linked List +1 |
| 117 | Populating Next Right Pointers in Each Node II | Medium | Tree, Depth-First Search, Breadth-First Search +2 |
| 114 | Flatten Binary Tree to Linked List | Medium | Stack, Tree, Depth-First Search +2 |
| 148 | Sort List | Medium | Linked List, Two Pointers, Divide and Conquer +2 |
| 23 | Merge k Sorted Lists | Hard | Linked List, Divide and Conquer, Heap (Priority Queue) +1 |
Tree Traversal (18)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 104 | Maximum Depth of Binary Tree | Easy | Tree, Depth-First Search, Breadth-First Search +1 |
| 100 | Same Tree | Easy | Tree, Depth-First Search, Breadth-First Search +1 |
| 226 | Invert Binary Tree | Easy | Tree, Depth-First Search, Breadth-First Search +1 |
| 101 | Symmetric Tree | Easy | Tree, Depth-First Search, Breadth-First Search +1 |
| 105 | Construct Binary Tree from Preorder and Inorder Traversal | Medium | Tree, Array, Hash Table +2 |
| 106 | Construct Binary Tree from Inorder and Postorder Traversal | Medium | Tree, Array, Hash Table +2 |
| 112 | Path Sum | Easy | Tree, Depth-First Search, Breadth-First Search +1 |
| 129 | Sum Root to Leaf Numbers | Medium | Tree, Depth-First Search, Binary Tree |
| 124 | Binary Tree Maximum Path Sum | Hard | Tree, Depth-First Search, Dynamic Programming +1 |
| 236 | Lowest Common Ancestor of a Binary Tree | Medium | Tree, Depth-First Search, Binary Tree |
| 199 | Binary Tree Right Side View | Medium | Tree, Depth-First Search, Breadth-First Search +1 |
| 637 | Average of Levels in Binary Tree | Easy | Tree, Depth-First Search, Breadth-First Search +1 |
| 102 | Binary Tree Level Order Traversal | Medium | Tree, Breadth-First Search, Binary Tree |
| 103 | Binary Tree Zigzag Level Order Traversal | Medium | Tree, Breadth-First Search, Binary Tree |
| 530 | Minimum Absolute Difference in BST | Easy | Tree, Depth-First Search, Breadth-First Search +2 |
| 230 | Kth Smallest Element in a BST | Medium | Tree, Depth-First Search, Binary Search Tree +1 |
| 98 | Validate Binary Search Tree | Medium | Tree, Depth-First Search, Binary Search Tree +1 |
| 108 | Convert Sorted Array to Binary Search Tree | Easy | Tree, Binary Search Tree, Array +2 |
Bit Manipulation (7)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 222 | Count Complete Tree Nodes | Easy | Bit Manipulation, Tree, Binary Search +1 |
| 67 | Add Binary | Easy | Bit Manipulation, Math, String +1 |
| 190 | Reverse Bits | Easy | Bit Manipulation, Divide and Conquer |
| 191 | Number of 1 Bits | Easy | Bit Manipulation, Divide and Conquer |
| 136 | Single Number | Easy | Bit Manipulation, Array |
| 137 | Single Number II | Medium | Bit Manipulation, Array |
| 201 | Bitwise AND of Numbers Range | Medium | Bit Manipulation |
Breadth-First Search (4)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 133 | Clone Graph | Medium | Depth-First Search, Breadth-First Search, Graph +1 |
| 433 | Minimum Genetic Mutation | Medium | Breadth-First Search, Hash Table, String |
| 127 | Word Ladder | Hard | Breadth-First Search, Hash Table, String |
| 322 | Coin Change | Medium | Breadth-First Search, Array, Dynamic Programming |
Topological Sort (2)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 207 | Course Schedule | Medium | Depth-First Search, Breadth-First Search, Graph +1 |
| 210 | Course Schedule II | Medium | Depth-First Search, Breadth-First Search, Graph +1 |
Backtracking (7)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 17 | Letter Combinations of a Phone Number | Medium | Hash Table, String, Backtracking |
| 77 | Combinations | Medium | Backtracking |
| 46 | Permutations | Medium | Array, Backtracking |
| 39 | Combination Sum | Medium | Array, Backtracking |
| 52 | N-Queens II | Hard | Backtracking |
| 22 | Generate Parentheses | Medium | String, Dynamic Programming, Backtracking |
| 79 | Word Search | Medium | Depth-First Search, Array, String +2 |
Monotonic Stack (8)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 35 | Search Insert Position | Easy | Array, Binary Search |
| 162 | Find Peak Element | Medium | Array, Binary Search |
| 33 | Search in Rotated Sorted Array | Medium | Array, Binary Search |
| 34 | Find First and Last Position of Element in Sorted Array | Medium | Array, Binary Search |
| 153 | Find Minimum in Rotated Sorted Array | Medium | Array, Binary Search |
| 4 | Median of Two Sorted Arrays | Hard | Array, Binary Search, Divide and Conquer |
| 69 | Sqrt(x) | Easy | Math, Binary Search |
| 300 | Longest Increasing Subsequence | Medium | Array, Binary Search, Dynamic Programming |
Heap / Priority Queue (4)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 215 | Kth Largest Element in an Array | Medium | Array, Divide and Conquer, Quickselect +2 |
| 502 | IPO | Hard | Greedy, Array, Sorting +1 |
| 373 | Find K Pairs with Smallest Sums | Medium | Array, Heap (Priority Queue) |
| 295 | Find Median from Data Stream | Hard | Design, Two Pointers, Data Stream +2 |
Other study lists
Or go by technique instead of by list: all LeetCode patterns · the full problem list.
The Top Interview 150 does not cover the problem you get asked
Stealth Interview is a desktop app for macOS and Windows. It reads the coding problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer is saying — while staying invisible to screen sharing.