given a array of integers. you have to remove elements from it until it is empty. You can remove as many elements as you want(let us say x) and the cost of removing those x elements from array is the bitwise or of all these x elements.We have to minimise the cost.
for instance,
array=1 2 3 4 5
if I remove 1, cost will be one.
if I remove 2 and 3 together bitwise or of 2 & 3 is 3. Its cost will be 3.
if I want to remove 2 3 4 5 together, the cost will be the bitwise or of 2,3,4 & 5 i.e. 7.
1 Like