Skip to main content

Mistake Clinic

Use the smallest reproducer that distinguishes the intended contract from the mistake. Save an actual attempt and repair; there is no required error quota.

Module-Specific Mistake Radar​

SymptomMinimal probeLikely cause and repair
Longest path repeats a vertexTwo paths with same endpoint but different visited setsMissing history; augment state or use DAG assumptions
A zero answer is recomputedEmpty or impossible counting stateTruthiness used as cache membership; separate unseen from zero
A second query repeats the first answerDigit bounds 25 then 9, target 3Cache survives changed fixed input; reset or key it
LIS accepts equal values[2,2]Upper-bound search implements nondecreasing semantics
LIS tails fail index order[3,5,6,2,4]Tails mistaken for witness; retain input predecessors
Empty string distance is zero'' -> 'abc'Missing boundary costs
Knapsack reports two copiesOne (2,3) item, W=4Ascending update violates previous-item layer
Knapsack value right, witness wrongSame one-item case with descending valuesMutable capacity parent points at a newer version
Grid invents a zero-reward routeAll-negative 2-by-2 gridUnreachable predecessors initialized to zero
Matrix tree has wrong cost[5,2,4,3]Split dimension factor or interval convention is wrong
Tree DP works on invalid graphTriangle plus isolated vertexEdge count used without connectedness/acyclicity checks
Tour omits closureTwo cities with no return edgeOpen-path answer substituted for tour
Digit zero counted many timesBound 100, sum 0Multiple representations or incorrect terminal semantics
Weighted schedule uses greedyTwo short jobs profit 3 each, one spanning profit 7Cardinality proof applied to weighted objective
DP time called table sizeMatrix-chain split loopCandidate work per state omitted

Practice Mistake Checks​

For P1–P5, inspect state sufficiency, dependency counts, cache lifetime and historical versions. For P6–P10, check strictness, alignment, capacity semantics, counted objects and impossible states. For P11–P20, check boundaries, structural preconditions, tour closure, digit padding and objective changes.

Classify each failure as state, decomposition, boundary, order, witness, cost or contract. Repair the explanation and code together. Recheck a fresh instance without the worked example. Persistent errors should send you to the matching concept and competency, not to a larger unrelated problem set.