values. Count the non-empty segments (contiguous pieces of the array) whose element sum is odd.
Segments with different bounds count separately, even when their contents match. The answer may be large, so return it modulo 10⁹ + 7.values=[2, 3, 4] → 4
The segments are [2]=2, [2, 3]=5, [2, 3, 4]=9, [3]=3, [3, 4]=7, [4]=4. Four of them have an odd sum.
values=[8, 6] → 0
Every number is even, so every sum is even.
values=[1, 1, 1, 1] → 6
values) ≤ 10⁵values[i] ≤ 100values=[2, 3, 4]
4
Run checks the first 3 tests in your browser. Submit checks all 73 tests on the server, hidden ones included.