DSA · Patterns
Patterns
The 8 patterns behind 80% of interview problems. Spot them, and the solution stops being a memory test.
- 8m
Sliding Window
Two pointers that move in the same direction to compute window-based answers in O(n).
arraysstringstwo-pointers - 7m
Two Pointers
Two indices moving from opposite ends — turns sorted-array search problems into O(n).
arraystwo-pointers - 6m
Fast & Slow Pointers (Floyd's)
One pointer moves twice as fast as the other — used to detect cycles and find midpoints in linked lists.
linked-listtwo-pointers - 9m
Binary Search (and its many faces)
Binary search isn't just 'find a key' — it's 'monotonic predicate' search, which solves a surprising number of problems in O(log n).
binary-searcharrays - 8m
Backtracking
DFS through the decision tree, pruning branches that cannot lead to a solution.
backtrackingrecursion - 10m
Dynamic Programming
Recursive subproblems with overlap → memo or tabulate. The hard part isn't the table; it's the recurrence.
dprecursion - 7m
Topological Sort
Order nodes such that every edge u→v has u before v — solves dependency, build, and course-prereq problems.
graphbfsdfs - 7m
Union-Find (Disjoint Set Union)
A near-O(1) data structure for connectivity questions — used in Kruskal, percolation, and dynamic graph problems.
graphunion-finddsu