Skip to main content

Practice ยท 2 of 4

Bisect the Corruption

CHALLENGE
Difficulty: advanced+25 XP

A pipeline of n stages transforms a value; exactly one stage is broken (it flips sign). You receive the stage functions pre-implemented in your editor and must implement size_t find_bad_stage(const int *injections, size_t n) โ€” injections holds each stage's output for the known input; find the first index where the value's sign differs from injections[0]'s sign (all stages before the bad one preserve it, all after inherit the flip).

Back to lesson: Practice: Forensics Drills