The sum of the bitwise of all the subarrays present in the array.
Answers
Answered by
0
A Naive approach is to take the OR all possible combination of array[] elements and then perform the summation of all values. Time complexity of this approach grows exponentially so it would not be better for large value of n.
An Efficient approach is to find the pattern with respect to the property of OR. Now again consider the subset in binary form like:
Answered by
0
Answer:
Given an array arr[] of size n, we need to find sum of all the values that comes from ORing all the elements of the subsets.
Similar questions
Science,
7 months ago
English,
7 months ago
India Languages,
7 months ago
Chemistry,
1 year ago
Geography,
1 year ago