1 to the log log if an alarm went off during that minute, and 0 otherwise.
A window is a non-empty run of consecutive minutes in the log. Count the windows in which the alarm went off exactly alarms times.log=[0, 1, 0, 0, 1], alarms=1 → 9
The windows holding exactly one 1 are [0,1], [0,1,0], [0,1,0,0], [1], [1,0], [1,0,0] around the first alarm, and [0,0,1], [0,1], [1] around the second: 9 in total.
log=[1, 1, 1], alarms=2 → 2
Only the first two minutes and the last two minutes give exactly two alarms.
log=[1, 0, 1], alarms=0 → 1
log[i] is 0 or 1log=[0, 1, 0, 0, 1], alarms=1
9
Run checks the first 3 tests in your browser. Submit checks all 75 tests on the server, hidden ones included.