Input: arr[] = {13, 2, 6, 8, 3, 5, 7, 10, 14, 15}
Output: 3
Explanation:
Step 1: Reverse subarray [2, 4] to modify the array to {13, 2, 3, 8, 6, 5, 7, 10, 14, 15}
Step 2: Reverse subarray [4, 5] to modify the array to {13, 2, 3, 8, 5, 6, 7, 10, 14, 15}
Step 3: Reverse subarray [8, 9] to modify the array to {13, 2, 3, 8, 5, 6, 7, 10, 15, 14}
After the above reversals, the sum of all adjacent element pairs is odd.
Therefore, the minimum reversals required is 3.
Input: arr[] = {1, 3, 4, 5, 9, 6, 8}
Output: 2