You are given an array of length N.
- A subsequence is a sequence that can be derived from another sequence by deleting
some elements without changing the order of the remaining elements.
You know that a subsequence is best if the sum of the elements of the subsequence is
odd and maximum among all such subsequences.
It is guaranteed that this array contains at least one subsequence with odd sum.
Your task is to find the sum of the elements of the best subsequence.
- First line of input contains T denoting number of test cases.
- First line of each test case contains N, the size of the array.
-. Second line of each test case contains N space-separated integers.
Print the expected answer for each test case in a new line.
-2 2 1 -3
-3 -10 2
Subsequence for 1st test case is [2,1].
Subsequence for 2nd test case is [−3,2].
Note: Your code should be able to convert the sample input into the sample output. However, this is not enough to pass the challenge, because the code will be run on multiple test cases. Therefore, your code must solve this problem statement.
using namespace std;
Please do comment If u have any Queries!