Problem 376 · Medium

Wiggle Subsequence

Find the length of the longest subsequence whose differences alternate between rising and falling. The visual marks each step as up or down and extends the alternating run.

Open the interactive visualisation