values. Check whether even and odd numbers alternate in it, meaning every two adjacent elements have different parity.
Return True if they do and False otherwise. A single-element array counts as alternating.values=[7, 10, 3, 4] → True
Odd, even, odd, even: neighbours always differ in parity.
values=[2, 5, 9] → False
5 and 9 are neighbours and both odd.
values=[42] → True
There are no neighbours, so nothing can break the rule.
values=[7, 10, 3, 4]
True
Run checks the first 3 tests in your browser. Submit checks all 121 tests on the server, hidden ones included.