GoLang Solution For LeetCode Problem: Longest Turbulent Subarray
Solving Longest Turbulent Subarray in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.
That is, the subarray is turbulent if the comparison sign flips between each adjacent pair of elements in the subarray.
Input: [9,4,2,10,7,8,8,1,9] Output: 5 Explanation: (A > A < A > A < A)
Input: [4,8,12,16] Output: 2
Input:  Output: 1
1 <= A.length <= 40000
0 <= A[i] <= 10^9
- 1 <= A.length <= 40000
- 0 <= A[i] <= 10^9
See the full details of the problem Longest Turbulent Subarray at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go