Practice · 1 of 3
The Flipping Row
CHALLENGE
Difficulty: advanced+25 XP
**Scenario.** n lamps in a row, each on or off. One move: choose a lamp and flip it AND its immediate neighbors. Which invariant decides reachability of the all-off state? **Which approach is the best fit? The program only needs to print the letter.** **A)** The number of on-lamps mod 3 **B)** The total number of moves used must be even **C)** No simple invariant exists — must search all 2^n states **D)** A weighted XOR pattern (each lamp has a fixed coefficient from the move structure) decides it
Press Submit to check your solution.
Back to lesson: Practice: Observation Drills