
January 15, 1990. AT&T's long distance network falls over for nine hours and blocks about half of all calls, roughly 60 million of them. The culprit is a single C statement: a break placed inside an if, inside a switch, that jumped out of the wrong block. A switch recovering from a glitch would get a second message, hit that stray break, skip the code that reset its state, and crash again, then tell its neighbors, who did the same. 114 switches went down like dominoes. Here is the same trap in miniature: a break that should skip one item exits the whole loop.
Repair this code
Repair the loop so it skips odd numbers and keeps going, instead of stopping at the first one.
Steps
$ sum_evens({2,4,6}, 3)
12
$ sum_evens({2,3,4}, 3)
6
$ sum_evens({1,2}, 2)
2
Expected files
Allowed functions
None. Write every helper yourself.
Loading solutions...