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.
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.