Given an array A[] of N numbers. Now, you need to find and print the Summation of the bitwise OR of all possible subsets of this array.
As answer can be large, print it Modulo \(10^9+7\)
Input:
The first line contains a single integer T denoting the number of test cases in a single test file.
The first line of each test case contains a number N denoting the number of elements in the given array.
The second line contains the N elements of the array.
Output:
For each test case output a single number denoting the Summation of bitwise OR of all possible subsets of the given array.
Input Constraints:
For [1, 2, 3], all possible subsets are {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}
The sum of OR of these subsets are, 1 + 2 + 3 + 3 + 3 + 3 + 3 = 18.
So, the answer would be 18.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor