NeetCode 150
The 150 problems that cover every interview pattern, explained from brute force to optimal, with NeetCode's video for each.
The NeetCode 150 is the most popular list of coding-interview problems, grouped by pattern. For every problem you get a statement in plain words, the intuition, a brute-force approach, the optimal approach with its complexity, NeetCode's video walkthrough, and reference solutions in C, C++, Java and Python that you can run against hidden tests right in the browser.
- Recognise all 18 core patterns, from hashing and two pointers to graphs and dynamic programming
- Go from a brute-force idea to an optimal solution and state its complexity
- Write bug-free solutions in your interview language, tested against edge cases
- Cover the problems product companies actually ask
Arrays & Hashing
Hash sets and maps, counting, prefix products and encoding.
| 01 | Contains DuplicateFree | Hash set | Easy | |
| 02 | Valid Anagram | Character counting | Easy | |
| 03 | Two Sum | Hash map of complements | Easy | |
| 04 | Group Anagrams | Hash map with a canonical key | Medium | |
| 05 | Top K Frequent Elements | Counting + bucket sort | Medium | |
| 06 | Product of Array Except Self | Prefix and suffix products | Medium | |
| 07 | Valid Sudoku | Hash sets per row, column and box | Medium | |
| 08 | Encode and Decode Strings | Length-prefixed encoding | Medium | |
| 09 | Longest Consecutive Sequence | Hash set, start only at sequence beginnings | Medium |
Two Pointers
Shrinking a range from both ends on sorted or symmetric data.
Sliding Window
Growing and shrinking a window over a sequence.
Stack
Matching, monotonic stacks and expression evaluation.
Binary Search
Halving the search space, including searching on the answer.
Linked List
Pointer manipulation, fast and slow pointers, and design.
Trees
DFS, BFS, BST properties and tree construction.
Tries
Prefix trees for word search and autocomplete.
Heap / Priority Queue
Top-k, streaming medians and scheduling.
Backtracking
Subsets, permutations, combinations and constraint search.
Graphs
BFS, DFS, topological sort and union-find.
Advanced Graphs
Shortest paths, minimum spanning trees and Eulerian paths.
1-D Dynamic Programming
One-dimensional state, from stairs to subsequences.
2-D Dynamic Programming
Grids, two strings and knapsack-style state.
Greedy
Locally optimal choices that are provably globally optimal.
Intervals
Sorting by start or end, merging and sweeping.
Math & Geometry
Matrix walks, number tricks and geometry.
Bit Manipulation
XOR, masks and bit counting.