Skip to content

Commit 4384f0d

Browse files
committed
Update 0978 solution
1 parent 37fde65 commit 4384f0d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func maxTurbulenceSize1(A []int) int {
4747
flag = lastNum - A[right]
4848
lastNum = A[right]
4949
} else {
50-
if right != left && flag != 0 {
50+
if flag != 0 {
5151
res = max(res, right-left+1)
5252
}
5353
left++

website/content/ChapterFour/0978.Longest-Turbulent-Subarray.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func maxTurbulenceSize1(A []int) int {
9797
flag = lastNum - A[right]
9898
lastNum = A[right]
9999
} else {
100-
if right != left && flag != 0 {
100+
if flag != 0 {
101101
res = max(res, right-left+1)
102102
}
103103
left++

0 commit comments

Comments
 (0)