Length of the longest alternating even odd subarray
Given an array a[] of N integers, the task is to find the length of the longest Alternating Even Odd subarray present in the array. Examples: Input: a[] = {1, 2, 3, 4, 5, 7, 9} Output: 5 Explanation: The subarray {1, 2, 3, 4, 5} has alternating even and odd elements.Input: a[] = {1, 3, 5} Output: 0