I ran the code with given input, and expected answer seems to be 6.
But, for the input [1,4,3,2,4,-1,8], the longest wiggle sequence is [3,2,4,-1,8]. Length of 5.
The first wiggle sequence [1,4,3] breaks when we see a 2, which is less than 3, when we expect a bigger number.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.