> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0376_wiggle_subsequence/slt.md).

# 思路1

思路很简单 就是 wiggle 就是一升一降。

那么 一个up 就要配一个 down 就 构成一组

所以 6 其实就是 有 up.. down ... up... down.... up ... down 至于 过程中 有几个连续的 up 或连续的down 不用管.

故 每变化一次 down就等于 up 的值+1

最后看看以谁结尾就是 wiggle 的次数

（反过来一降一升也是一样的）
