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)

#ProblemDifficultyTopics
88Merge Sorted ArrayEasyArray, Two Pointers, Sorting
27Remove ElementEasyArray, Two Pointers
26Remove Duplicates from Sorted ArrayEasyArray, Two Pointers
80Remove Duplicates from Sorted Array IIMediumArray, Two Pointers
189Rotate ArrayMediumArray, Math, Two Pointers
151Reverse Words in a StringMediumTwo Pointers, String
28Find the Index of the First Occurrence in a StringEasyTwo Pointers, String, String Matching
125Valid PalindromeEasyTwo Pointers, String
392Is SubsequenceEasyTwo Pointers, String, Dynamic Programming
167Two Sum II - Input Array Is SortedMediumArray, Two Pointers, Binary Search
11Container With Most WaterMediumGreedy, Array, Two Pointers
153SumMediumArray, Two Pointers, Sorting
202Happy NumberEasyHash Table, Math, Two Pointers
5Longest Palindromic SubstringMediumTwo Pointers, String, Dynamic Programming

Sorting (5)

#ProblemDifficultyTopics
169Majority ElementEasyArray, Hash Table, Divide and Conquer +2
274H-IndexMediumArray, Counting Sort, Sorting
242Valid AnagramEasyHash Table, String, Sorting
49Group AnagramsMediumArray, Hash Table, String +1
56Merge IntervalsMediumArray, Sorting

Dynamic Programming (9)

#ProblemDifficultyTopics
121Best Time to Buy and Sell StockEasyArray, Dynamic Programming
53Maximum SubarrayMediumArray, Divide and Conquer, Dynamic Programming
70Climbing StairsEasyMemoization, Math, Dynamic Programming
198House RobberMediumArray, Dynamic Programming
120TriangleMediumArray, Dynamic Programming
97Interleaving StringMediumString, Dynamic Programming
72Edit DistanceMediumString, Dynamic Programming
123Best Time to Buy and Sell Stock IIIHardArray, Dynamic Programming
188Best Time to Buy and Sell Stock IVHardArray, Dynamic Programming

Greedy (6)

#ProblemDifficultyTopics
122Best Time to Buy and Sell Stock IIMediumGreedy, Array, Dynamic Programming
55Jump GameMediumGreedy, Array, Dynamic Programming
45Jump Game IIMediumGreedy, Array, Dynamic Programming
134Gas StationMediumGreedy, Array
135CandyHardGreedy, Array
452Minimum Number of Arrows to Burst BalloonsMediumGreedy, Array, Sorting

Math and Number Theory (8)

#ProblemDifficultyTopics
380Insert Delete GetRandom O(1)MediumDesign, Array, Hash Table +2
13Roman to IntegerEasyHash Table, Math, String
12Integer to RomanMediumHash Table, Math, String
9Palindrome NumberEasyMath
66Plus OneEasyArray, Math
172Factorial Trailing ZeroesMediumMath
50Pow(x, n)MediumRecursion, Math
149Max Points on a LineHardGeometry, Array, Hash Table +1

Prefix Sum (1)

#ProblemDifficultyTopics
238Product of Array Except SelfMediumArray, Prefix Sum

Stack (8)

#ProblemDifficultyTopics
42Trapping Rain WaterHardStack, Array, Two Pointers +2
20Valid ParenthesesEasyStack, String
71Simplify PathMediumStack, String
155Min StackMediumStack, Design
150Evaluate Reverse Polish NotationMediumStack, Array, Math
224Basic CalculatorHardStack, Recursion, Math +1
173Binary Search Tree IteratorMediumStack, Tree, Design +3
918Maximum Sum Circular SubarrayMediumQueue, Array, Divide and Conquer +2

Hash Map (7)

#ProblemDifficultyTopics
58Length of Last WordEasyString
6Zigzag ConversionMediumString
68Text JustificationHardArray, String, Simulation
383Ransom NoteEasyHash Table, String, Counting
205Isomorphic StringsEasyHash Table, String
290Word PatternEasyHash Table, String
1Two SumEasyArray, Hash Table

Trie (5)

#ProblemDifficultyTopics
14Longest Common PrefixEasyTrie, Array, String
208Implement Trie (Prefix Tree)MediumDesign, Trie, Hash Table +1
211Design Add and Search Words Data StructureMediumDepth-First Search, Design, Trie +1
212Word Search IIHardTrie, Array, String +2
139Word BreakMediumTrie, Memoization, Array +3

Sliding Window (5)

#ProblemDifficultyTopics
209Minimum Size Subarray SumMediumArray, Binary Search, Prefix Sum +1
3Longest Substring Without Repeating CharactersMediumHash Table, String, Sliding Window
30Substring with Concatenation of All WordsHardHash Table, String, Sliding Window
76Minimum Window SubstringHardHash Table, String, Sliding Window
219Contains Duplicate IIEasyArray, Hash Table, Sliding Window

Matrix and Grid (11)

#ProblemDifficultyTopics
36Valid SudokuMediumArray, Hash Table, Matrix
54Spiral MatrixMediumArray, Matrix, Simulation
48Rotate ImageMediumArray, Math, Matrix
73Set Matrix ZeroesMediumArray, Hash Table, Matrix
289Game of LifeMediumArray, Matrix, Simulation
909Snakes and LaddersMediumBreadth-First Search, Array, Matrix
427Construct Quad TreeMediumTree, Array, Divide and Conquer +1
74Search a 2D MatrixMediumArray, Binary Search, Matrix
64Minimum Path SumMediumArray, Dynamic Programming, Matrix
63Unique Paths IIMediumArray, Dynamic Programming, Matrix
221Maximal SquareMediumArray, Dynamic Programming, Matrix

Union-Find (4)

#ProblemDifficultyTopics
128Longest Consecutive SequenceMediumUnion Find, Array, Hash Table
200Number of IslandsMediumDepth-First Search, Breadth-First Search, Union Find +2
130Surrounded RegionsMediumDepth-First Search, Breadth-First Search, Union Find +2
399Evaluate DivisionMediumDepth-First Search, Breadth-First Search, Union Find +4

Other (2)

#ProblemDifficultyTopics
228Summary RangesEasyArray
57Insert IntervalMediumArray

Linked List (15)

#ProblemDifficultyTopics
141Linked List CycleEasyHash Table, Linked List, Two Pointers
2Add Two NumbersMediumRecursion, Linked List, Math
21Merge Two Sorted ListsEasyRecursion, Linked List
138Copy List with Random PointerMediumHash Table, Linked List
92Reverse Linked List IIMediumLinked List
25Reverse Nodes in k-GroupHardRecursion, Linked List
19Remove Nth Node From End of ListMediumLinked List, Two Pointers
82Remove Duplicates from Sorted List IIMediumLinked List, Two Pointers
61Rotate ListMediumLinked List, Two Pointers
86Partition ListMediumLinked List, Two Pointers
146LRU CacheMediumDesign, Hash Table, Linked List +1
117Populating Next Right Pointers in Each Node IIMediumTree, Depth-First Search, Breadth-First Search +2
114Flatten Binary Tree to Linked ListMediumStack, Tree, Depth-First Search +2
148Sort ListMediumLinked List, Two Pointers, Divide and Conquer +2
23Merge k Sorted ListsHardLinked List, Divide and Conquer, Heap (Priority Queue) +1

Tree Traversal (18)

#ProblemDifficultyTopics
104Maximum Depth of Binary TreeEasyTree, Depth-First Search, Breadth-First Search +1
100Same TreeEasyTree, Depth-First Search, Breadth-First Search +1
226Invert Binary TreeEasyTree, Depth-First Search, Breadth-First Search +1
101Symmetric TreeEasyTree, Depth-First Search, Breadth-First Search +1
105Construct Binary Tree from Preorder and Inorder TraversalMediumTree, Array, Hash Table +2
106Construct Binary Tree from Inorder and Postorder TraversalMediumTree, Array, Hash Table +2
112Path SumEasyTree, Depth-First Search, Breadth-First Search +1
129Sum Root to Leaf NumbersMediumTree, Depth-First Search, Binary Tree
124Binary Tree Maximum Path SumHardTree, Depth-First Search, Dynamic Programming +1
236Lowest Common Ancestor of a Binary TreeMediumTree, Depth-First Search, Binary Tree
199Binary Tree Right Side ViewMediumTree, Depth-First Search, Breadth-First Search +1
637Average of Levels in Binary TreeEasyTree, Depth-First Search, Breadth-First Search +1
102Binary Tree Level Order TraversalMediumTree, Breadth-First Search, Binary Tree
103Binary Tree Zigzag Level Order TraversalMediumTree, Breadth-First Search, Binary Tree
530Minimum Absolute Difference in BSTEasyTree, Depth-First Search, Breadth-First Search +2
230Kth Smallest Element in a BSTMediumTree, Depth-First Search, Binary Search Tree +1
98Validate Binary Search TreeMediumTree, Depth-First Search, Binary Search Tree +1
108Convert Sorted Array to Binary Search TreeEasyTree, Binary Search Tree, Array +2

Bit Manipulation (7)

#ProblemDifficultyTopics
222Count Complete Tree NodesEasyBit Manipulation, Tree, Binary Search +1
67Add BinaryEasyBit Manipulation, Math, String +1
190Reverse BitsEasyBit Manipulation, Divide and Conquer
191Number of 1 BitsEasyBit Manipulation, Divide and Conquer
136Single NumberEasyBit Manipulation, Array
137Single Number IIMediumBit Manipulation, Array
201Bitwise AND of Numbers RangeMediumBit Manipulation

Breadth-First Search (4)

#ProblemDifficultyTopics
133Clone GraphMediumDepth-First Search, Breadth-First Search, Graph +1
433Minimum Genetic MutationMediumBreadth-First Search, Hash Table, String
127Word LadderHardBreadth-First Search, Hash Table, String
322Coin ChangeMediumBreadth-First Search, Array, Dynamic Programming

Topological Sort (2)

#ProblemDifficultyTopics
207Course ScheduleMediumDepth-First Search, Breadth-First Search, Graph +1
210Course Schedule IIMediumDepth-First Search, Breadth-First Search, Graph +1

Backtracking (7)

#ProblemDifficultyTopics
17Letter Combinations of a Phone NumberMediumHash Table, String, Backtracking
77CombinationsMediumBacktracking
46PermutationsMediumArray, Backtracking
39Combination SumMediumArray, Backtracking
52N-Queens IIHardBacktracking
22Generate ParenthesesMediumString, Dynamic Programming, Backtracking
79Word SearchMediumDepth-First Search, Array, String +2

Monotonic Stack (8)

#ProblemDifficultyTopics
35Search Insert PositionEasyArray, Binary Search
162Find Peak ElementMediumArray, Binary Search
33Search in Rotated Sorted ArrayMediumArray, Binary Search
34Find First and Last Position of Element in Sorted ArrayMediumArray, Binary Search
153Find Minimum in Rotated Sorted ArrayMediumArray, Binary Search
4Median of Two Sorted ArraysHardArray, Binary Search, Divide and Conquer
69Sqrt(x)EasyMath, Binary Search
300Longest Increasing SubsequenceMediumArray, Binary Search, Dynamic Programming

Heap / Priority Queue (4)

#ProblemDifficultyTopics
215Kth Largest Element in an ArrayMediumArray, Divide and Conquer, Quickselect +2
502IPOHardGreedy, Array, Sorting +1
373Find K Pairs with Smallest SumsMediumArray, Heap (Priority Queue)
295Find Median from Data StreamHardDesign, Two Pointers, Data Stream +2

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.