</>

Patterns

The 18 NeetCode roadmap categories, organized by problem-solving technique.

Arrays & Hashing

13

Use hash maps/sets to turn O(n²) scans into O(n) lookups; the bread-and-butter of array problems.

Two Pointers

8

Walk two indices through a (often sorted) array to find pairs or partitions in linear time.

Sliding Window

7

Maintain a contiguous window and update an aggregate as it grows and shrinks.

Stack

10

LIFO structure for matching, monotonic scans, and expression evaluation.

Binary Search

10

Repeatedly halve a sorted (or monotonic) search space for logarithmic lookups.

Linked List

11

Pointer manipulation: reversal, fast/slow cycle detection, merging, and dummy heads.

Trees

18

Recursive DFS and level-order BFS over binary trees and BSTs.

Tries

4

Prefix trees for fast word insertion, search, and prefix queries.

Heap / Priority Queue

8

Keep the min/max accessible in O(log n) for top-k and scheduling problems.

Backtracking

9

Systematically build candidates and undo choices to enumerate combinations/permutations.

Graphs

15

Model relationships as nodes & edges; traverse with BFS/DFS, often on grids.

Advanced Graphs

8

Shortest paths (Dijkstra), MST, topological order, and union-find connectivity.

1-D Dynamic Programming

15

Optimal substructure captured in a one-dimensional table or rolling variables.

2-D Dynamic Programming

13

Grid/string DP where each cell depends on neighbors above/left.

Greedy

10

Make the locally optimal choice when it provably yields a global optimum.

Intervals

7

Sort by endpoints, then sweep to merge, insert, or count overlaps.

Math & Geometry

12

Number theory, matrix manipulation, and coordinate tricks.

Bit Manipulation

10

XOR, masks, and bit counting for space-efficient O(1) tricks.