For [1,4,3,2,4,-1,8] shouldn't the answer be 5?

  • 0

    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.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.