Back to the Problem
Scan positions 2..N-1 and compare each element with its two neighbours.
Complexity: O(N)