Skip to content

Problem catalog

Use this catalog after learning a pattern. Search the page for a signal such as “shortest,” “prefix,” “capacity,” or “version.” Before opening a solution, write the state, invariant, and target complexity.

Difficulty labels are orientation only: E easy, M medium, H hard.

flowchart LR
  accTitle: Deliberate practice loop for algorithm problems
  accDescr: Start from a problem signal, choose a candidate chapter, write the state and invariant before coding, test the solution, record the failure mode, and retry a related harder problem.
  A["Name the problem signal"] --> B["Choose a candidate pattern<br/>from this catalog"]
  B --> C["Write state, invariant,<br/>transition, and target cost"]
  C --> D["Implement without<br/>opening the solution"]
  D --> E["Test normal, boundary,<br/>and adversarial cases"]
  E --> F{"Accepted and<br/>proof still holds?"}
  F -->|"no"| G["Record the failed assumption<br/>and repair the model"]
  G --> C
  F -->|"yes"| H["Solve a nearby problem<br/>with one changed constraint"]
  H --> A

The catalog is most useful when the first written artifact is the invariant, not code. A wrong invariant exposes a modeling error earlier than a failed submission does.

Arrays, hashing, and windows

Problem Level Signal → pattern Ask first
Two Sum E complement → hash map What belongs to the scanned past?
Group Anagrams M canonical key → hash groups Which representation makes equivalents equal?
Subarray Sum Equals K M signed subarray → prefix frequency Which earlier prefix completes the target?
Longest Substring Without Repeating Characters M monotone validity → window What forces the left edge forward?
Sliding Window Maximum H fixed-window extreme → deque Which candidates are permanently dominated?

Read Chapter 3 and Chapter 4.

Linked lists and composite ownership

Problem Level Signal → pattern Ask first
Reverse Linked List E pointer rewiring → reversed prefix Did I save the unread suffix?
Linked List Cycle II M cycle entry → slow/fast What distance relation holds at the meeting?
LRU Cache M lookup + recency → map + list Which structure owns identity and which owns order?
LFU Cache H lookup + frequency + recency What moves atomically after access?
Snapshot Array M versions + sparse writes → histories + binary search What is the newest visible change?

Read linked lists and Chapter 11.

Trees, heaps, and range indexes

Problem Level Signal → pattern Ask first
Binary Tree Level Order Traversal M layers → BFS queue When does one level end?
Validate Binary Search Tree M global ordering → bounds Which ancestor bounds constrain this node?
Kth Largest Element in an Array M top k → heap/selection Must all values be sorted?
Implement Trie M prefix lookup → Trie Where is word termination stored?
Range Sum Query – Mutable M updates + ranges → Fenwick/segment Is update additive or assignment?

Read Chapter 5 and Chapter 13.

Graph traversal and structure

Problem Level Signal → pattern Ask first
Number of Islands M components → DFS/BFS What creates an edge between cells?
Rotting Oranges M simultaneous waves → multi-source BFS Which sources enter at time zero?
Course Schedule M prerequisites → topological sort Is the request an order or only cycle detection?
Network Delay Time M nonnegative shortest paths → Dijkstra Are all edge weights nonnegative?
Critical Connections in a Network H edge failure → bridges Can the child subtree reach an ancestor?

Read Chapter 6.

Advanced graphs

Problem Level Signal → pattern Ask first
Min Cost to Connect All Points M cheapest connectivity → MST Is a path cost or whole-network cost requested?
Cheapest Flights Within K Stops M bounded edges → layered Bellman–Ford/DP Which iteration count represents allowed edges?
Find the City With the Smallest Number of Neighbors M all sources + small graph → Floyd/Dijkstra Which V and density bound wins?
Maximum Employees to Be Invited to a Meeting H functional-graph cycles → SCC/cycle decomposition Which vertices share a cycle?
Maximum Number of Accepted Invitations M bipartite assignment → matching/flow What are the left and right partitions?

Read Chapter 10.

Binary search and greedy

Problem Level Signal → pattern Ask first
Search in Rotated Sorted Array M one sorted half → exact binary search Which half is provably ordered?
Koko Eating Bananas M minimum feasible rate → first true Is feasibility monotone?
Find Minimum in Rotated Sorted Array M transition boundary → first true Which side contains the pivot?
Non-overlapping Intervals M maximize compatible count → earliest finish Can an optimum exchange its first interval?
Jump Game M reachable prefix → stay-ahead greedy What is the farthest certified index?

Read Chapter 7 and greedy algorithms.

Problem Level Signal → pattern Ask first
Subsets II M choose/skip + duplicates → sorted backtracking Which equal choice is redundant at this depth?
Combination Sum M reuse candidates → backtracking Does the next call keep or advance the index?
Permutations M ordered choices → used set What defines one decision-tree level?
Word Search M path with undo → grid backtracking Which state must be restored?
N-Queens H constraint placement → backtracking sets Which conflicts can be checked in O(1)?

Read Chapter 8.

Dynamic programming

Problem Level Signal → state shape Ask first
House Robber M local exclusion → dp[i] What does the prefix answer promise?
Coin Change M reusable amounts → dp[amount] Is reuse allowed in the same stage?
Longest Common Subsequence M two prefixes → dp[i][j] What happens on match versus mismatch?
Cherry Pickup II H row + two agents → dp[row][c1][c2] Which coordinates determine the future?
Burst Balloons H choose last in interval → interval DP Which choice makes the two sides independent?

Read Chapter 9.

External practice sets

Use the platform for the prompt and judge; use this book for choosing the model, stating the invariant, and reviewing the failure modes.