History, asked by rajni8090, 1 year ago

The sum of the bitwise of all the subarrays present in the array.

Answers

Answered by Sonalibendre
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 UrvashiBaliyan
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