You are given a nums. A subarray of nums of length m (where
nums[i + 1] - nums[i] = 1 for all even indices i where
nums[i + 1] - nums[i] = -1 for all odd indices i where
Return the maximum length of any alternating subarray in nums. If no alternating subarray exists, return
Constraints:
nums.length
nums[i]
You are given a nums. A subarray of nums of length m (where
nums[i + 1] - nums[i] = 1 for all even indices i where
nums[i + 1] - nums[i] = -1 for all odd indices i where
Return the maximum length of any alternating subarray in nums. If no alternating subarray exists, return
Constraints:
nums.length
nums[i]