Data Structures Cheat Sheet
All 12 essential structures visualized — create, insert, delete, and traverse each one step by step. Python code snippets for every operation, complexity tables, and interview gotchas.
Algorithm Patterns Cheat Sheet
40 algorithm patterns across 10 categories — two pointers, binary search, graphs, trees, DP, backtracking, heaps, and more. Python snippets with complexity tables and gotchas for each pattern.
Dijkstra's Shortest Path
Find shortest paths from a source to every node. Greedy extract-min from a priority queue locks in distances closest-first.
Topological Sort
Order nodes so every edge points forward. Peel off zero-in-degree nodes, remove their outgoing edges, repeat until the DAG is gone.
Fibonacci
Classic 1-D DP. Each value is the sum of the previous two, filled bottom-up into a table.
Climbing Stairs
Count distinct ways to climb n steps when each move is 1 or 2 steps. Same recurrence as Fibonacci, different framing.
House Robber
Max loot without robbing adjacent houses. Each house decides: skip, or take and jump two ahead.
Coin Change
Fewest coins to make a target amount. Rows are coin types, columns are amounts — each cell decides: skip this coin or use it.
Longest Common Subsequence
Find the longest subsequence shared by two strings. A 2-D table indexed by prefix lengths of each string.
Edit Distance
Minimum insert, delete, or replace operations to transform one string into another. Levenshtein distance.
Maximum Product Subarray
Track both the running max and min products — a negative times a negative can flip the smallest track into the largest. See all three candidates race at every index.
Longest Palindromic Substring
Find the longest palindrome inside a string. Expand around each center — odd and even — and track the best window seen.
Minimum Window Substring
Find the smallest window containing all characters of a target string. Expand R until valid, shrink L to minimize — the formed counter gives O(1) validity checks.