diff --git a/problems/0376.摆动序列.md b/problems/0376.摆动序列.md index 4d283eb0..f64e0043 100644 --- a/problems/0376.摆动序列.md +++ b/problems/0376.摆动序列.md @@ -151,7 +151,24 @@ class Solution: ``` Go: - +```golang +func wiggleMaxLength(nums []int) int { + var count,preDiff,curDiff int + count=1 + if len(nums)<2{ + return count + } + for i:=0;i 0 && preDiff <= 0) || (preDiff >= 0 && curDiff < 0){ + preDiff=curDiff + count++ + } + } + return count +} +``` Javascript: ```Javascript