Longest Turbulent Subarray
Find the longest contiguous stretch in which neighbouring values keep alternating between rising and falling. The visual shows the direction of each step as a sign that flips with every comparison.
Find the longest contiguous stretch in which neighbouring values keep alternating between rising and falling. The visual shows the direction of each step as a sign that flips with every comparison.