18 patterns · Beginner → Advanced

DSA Patterns Guide

Every data-structures & algorithms interview pattern in learning order — concepts, when to use each, tips, and practice problems.

Arrays & Hashing

The foundation. Master hash maps and sets to trade space for time and turn O(n²) brute force into O(n). (9 problems · Foundations)

Two Pointers

Two indices moving through a sorted structure to avoid nested loops. (5 problems · Foundations)

Stack

LIFO order for matching, backtracking through history, and monotonic tricks. (7 problems · Foundations)

Binary Search

Halve the search space every step — not just on sorted arrays, but on answer spaces too. (7 problems · Foundations)

Sliding Window

A window that grows and shrinks over a sequence to track a running condition in linear time. (6 problems · Foundations)

Linked List

Pointer manipulation, fast/slow runners, and in-place reversal. (11 problems · Core Structures)

Trees

Recursion's best friend. DFS, BFS, and traversal order define most tree problems. (15 problems · Core Structures)

Tries

A tree built for prefixes — powers autocomplete and word search problems. (3 problems · Core Structures)

Heap / Priority Queue

Always grab the min or max in O(log n) — essential for top-k and scheduling problems. (7 problems · Core Structures)

Backtracking

Explore, and undo — build every valid combination by pruning as you go. (9 problems · Search & Graphs)

Graphs

Model relationships as nodes and edges; traverse with DFS/BFS and union-find. (13 problems · Search & Graphs)

Advanced Graphs

Shortest paths and minimum spanning trees with Dijkstra and friends. (6 problems · Search & Graphs)

1-D Dynamic Programming

Break a problem into overlapping subproblems along a single dimension. (12 problems · Dynamic Programming)

2-D Dynamic Programming

Extend DP across two dimensions — grids, strings, and sequences compared pairwise. (11 problems · Dynamic Programming)

Greedy

Make the locally optimal choice at each step and prove it leads to a global optimum. (8 problems · Final Stretch)

Intervals

Sort by start or end time, then sweep — the key to overlap and scheduling problems. (6 problems · Final Stretch)

Math & Geometry

Number theory, simulation, and coordinate geometry that show up in unexpected places. (8 problems · Final Stretch)

Bit Manipulation

XOR tricks, bit masks, and shifting — small operations with outsized interview value. (7 problems · Final Stretch)