Problem 2765 · Easy

Longest Alternating Subarray

An alternating subarray starts with a rise of 1 and then alternates rising and falling by 1, so each start is extended while the pattern holds.

Open the interactive visualisation