Skip to main content

Practice ยท 4 of 4

Shrink the Repro

CHALLENGE
Difficulty: advanced+25 XP

Given a boolean test over a bitmask (bit i = keep element i), implement unsigned int shrink(unsigned int failing, size_t width, pred_fn pred) โ€” pred(bits) returns true iff the masked element subset still fails; return the smallest subset (as bits) that still fails. Simple greedy: try removing each kept element from the highest index down; keep the removal if it still fails. Never reduce below a single element โ€” a repro must still exercise the failure.

Back to lesson: Practice: Forensics Drills