Maximum Sum Subsequence made up of consecutive elements of different parity
Given an array arr[] consisting of N integers, the task is to find the maximum sum of a non-empty subsequence such that each pair of consecutive terms is of different parity (even or odd). Examples: Input: arr[] = {1, 2, 6, 8, -5, 10}Output: 14Explanation: Considering the subsequence {1, 8, -5, 10}