NeetCode #779LC-978MediumGreedyNC 250
← Back to All Problems#779 · #978 · Longest Turbulent Subarray(最长湍流子数组)
📌 Problem Statement & Constraints
A subarray is turbulent if the comparison sign between adjacent elements alternates (
<, >, <, ... or >, <, >, ...). Return the length of the longest turbulent subarray of arr. Constraints: 1 <= arr.length <= 4 * 10^4, 0 <= arr[i] <= 10^9.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!