๐ WAYPOINT LESSON
The Adversarial Checklist
โญโญโญ advancedโณ 12 min read๐ Lesson 240 of 281
Five input shapes break most unproven solutions. Run the checklist on every solution you are proud of.
The Adversarial Checklist
Before trusting any solution, attack it with these five shapes:
- All ties. Every element equal; every weight identical; every deadline the same. Tie-break branches that never ran on random data run now.
- Asymmetry. A path graph; one huge element among tiny ones; an interval swallowing all others. Symmetric data flatters symmetric bugs.
- Degeneracy. n = 1; n = 0 if legal; empty ranges; single-point intervals; self-loops; duplicates everywhere.
- Extremes. Maximum values (overflow), minimum values (underflow of assumptions like "positive"), alternating max/min patterns that maximize comparison counts.
- Adversarial order. Sorted-descending input to a "sort then process" claim; reversed trees; queries ordered worst-case-first.
The mindset
For each shape, the question is not "will my code break?" but "what would I input if I were trying to break it?" That inversion finds bugs that rereading never will, because you wrote the code and your brain auto-corrects while reading.
Cost-benefit
The checklist costs minutes. A wrong submission costs the problem, the confidence, and often the contest. There is no scenario where skipping the checklist is correct arithmetic.