Determine whether a given integer sequence forms a straight arithmetic progression with step 2.
You are given a sequence of integers. Your task is to determine whether the sequence is a valid “Straight <<A>>” sequence: each next value should differ from the previous one by exactly 2, and the sequence should progress consistently throughout.
In other words, for every adjacent pair, the difference must be the same, and that common difference must be 2.
Return whether the sequence satisfies this condition.
n — the length of the sequence.n integers a1, a2, ..., an.YES if the sequence is a straight progression with common difference 2.NO.1 <= n <= $10^{5}$Example 1
Input
4 1 3 5 7
Output
YES
Explanation
Every adjacent difference is 2, so the sequence is valid.
Example 2
Input
4 1 4 6 8
Output
NO
Explanation
The first difference is 3, so the sequence does not use a consistent step of 2.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.