diff --git a/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray.go b/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray.go index 60d3eace1..8a0890269 100644 --- a/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray.go +++ b/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray.go @@ -47,7 +47,7 @@ func maxTurbulenceSize1(A []int) int { flag = lastNum - A[right] lastNum = A[right] } else { - if right != left && flag != 0 { + if flag != 0 { res = max(res, right-left+1) } left++ diff --git a/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md b/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md index e4b8bea71..43dcd7f9b 100755 --- a/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md +++ b/website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md @@ -97,7 +97,7 @@ func maxTurbulenceSize1(A []int) int { flag = lastNum - A[right] lastNum = A[right] } else { - if right != left && flag != 0 { + if flag != 0 { res = max(res, right-left+1) } left++