Bitwise anding interesting question. Simple yet not so simple.

Revision en2, by abhaypatil2000, 2021-11-12 23:35:13

Given an array $$$A$$$ of $$$n$$$ integers, the elements are shuffled to form an array $$$B$$$.

Let the array $$$B$$$ be $$$b_0,b_1,...b_{n-1}$$$.

We define $$$f_i = b_0$$$&$$$b_1$$$&$$$... b_i$$$.

We need to find the minimum possible value of $$$\sum_{i=0}^{n-1} f_i$$$.

Constraints:
1 <= n <= 1000
0 <= $$$b_i$$$ <= 1015

Tags bitwise operators, array, minimization

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English abhaypatil2000 2021-11-13 01:19:34 145
en3 English abhaypatil2000 2021-11-13 01:15:07 1226
en2 English abhaypatil2000 2021-11-12 23:35:13 67 Tiny change: 'nstraints:\n1 <= n <= 1000\n0 <= $b_' -> 'nstraints: \n1 <= n <= 1000 \n0 <= $b_'
en1 English abhaypatil2000 2021-11-12 23:33:44 322 Initial revision (published)