As we mentioned earlier, bitwise operations can be used to find number of subsets. Here, we will use that.
Given an array A of N elements. The task is to count all the subsets whose sum is even.
For each testcase, first line of input contains number of testcases T. For each testcase, there will be two lines, first of which containing N and next line contains N space seperated positive integers.
For each testcase, print the count of subsets whose sum of all elements is even.
1 <= T <= 100
1 <= N <= 10
1 <= A[i] <= 10
Your task is to complete the function countSumSubsets() which counts all the subsets in which sum of all the elements is even.
1 2 3
Testcase 1: Three subsets are there whose sum of elements is even. Subsets are (3, 2, 1), (1, 3), (2).
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.