From 4384f0d468ca2b50e604cdc303c8c3f34b4c02df Mon Sep 17 00:00:00 2001 From: YDZ Date: Wed, 25 Nov 2020 00:46:59 +0800 Subject: [PATCH] Update 0978 solution --- .../978. Longest Turbulent Subarray.go | 2 +- website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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++