Problem of the day
Input: ‘N’ = 3, ‘ARR’ = {2, 5, 8}
Output: 3
In this case, there are ‘3’ possible even sequences i.e. [2], [8], and [2, 8].
The first line will contain the integer ‘T’, the number of test cases.
Each test case consists of two lines.
The first line of input contains one integer, ‘N’, the length of the array ‘ARR’.
Followed by a line containing space-separated ‘N’ positive integers, denoting the elements of the array.
For each test case, print the number of non-empty even sequences that can be formed by using the elements of the given array.
You don't need to print anything. It has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 10
1 <= ‘N’ <= 10^5
1 <= ‘ARR[i]’ <= 10^9
It is guaranteed that sum of ‘N’ over all test cases is <= 10^5
Time Limit: 1 sec
2
5
1 2 3 4 5
5
3 2 2 1 6
3
7
For the first test case, the even elements of the array ‘ARR’ are [2, 4]. Hence the non-empty even sequences are - [2], [4], [2, 4].
Hence, the output will be: 3
For the second test case, the even elements of the array ‘ARR’ are [2, 2, 6]. Hence the non-empty even sequences are - [2], [2], [6], [2, 2], [2, 6], [2, 6], [2, 2, 6].
Hence, the output will be: 7
2
10
16 4 12 6 10 2 18 2 14 20
8
1 5 3 9 7 5 3 11
1023
0