Skip to content

Coding Problems

Overview

This section covers 180+ LeetCode problems organized by pattern category. The core set is the NeetCode 150, the de facto modern interview prep list and a superset of Blind 75. Beyond that, each category includes bonus problems drawn from the data-structure and algorithm pages on this site — problems that reinforce the same patterns but fall outside the curated 150.

NeetCode 150 problems are tagged neetcode-150 in their frontmatter. Bonus problems appear in the same category directories without that tag.

Every problem page includes:

  1. Brute force: the most direct approach, always correct, often O(n2)O(n²) or worse.
  2. Improved / optimal: the interview-level answer, best achievable time and space.

Each approach has working Python, line-labeled code, and a per-line complexity table. Many pages also include a How to recognize this pattern section covering the signal in the problem statement, a counterexample that breaks the tempting-but-wrong approach, and a table of related problems with the same shape.

For the reusable tactics behind those solutions, use Coding Concepts. Those pages explain ideas like two pointers, sliding windows, greedy exchange arguments, memoization, graph traversal, heaps, and monotonic structures, then link back to representative problems.

Categories

CategoryProblems
Arrays & Hashing18
Two Pointers5
Sliding Window9
Stack16
Binary Search8
Linked List14
Trees17
Heap / Priority Queue7
Backtracking9
Tries3
Graphs19
Advanced Graphs8
1-D Dynamic Programming12
2-D Dynamic Programming11
Greedy8
Intervals6
Math & Geometry8
Bit Manipulation7

Browse by difficulty

Pattern-grouping is the default. Difficulty is the orthogonal axis when you want to ramp up gradually or save the hard set for last.

How to use

Work through a category end-to-end. Within each problem:

  • Read the prompt. Try to solve without scrolling.
  • If stuck, read only Approach 1 (brute force). Reimplement yourself.
  • Compare your solution with the optimal approach. Understand why the gap closes: usually a hash map, a monotonic structure, or a clever invariant.
  • Check the “How to recognize this pattern” section if the page has one. It contains the signal to look for and the counterexample that breaks the wrong approach.

Complexity sections use standard Big-O notation. n is the input size unless otherwise noted.

References

  • Data structures, the longer-form reference for the structures used in every solution.
  • Named algorithms, the canonical algorithms that show up inside these problems: Dijkstra, Tarjan, KMP, Floyd’s, and more.
  • Coding concepts, the approach vocabulary behind the problem solutions.