How to perform this algorithm? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How to perform this algorithm?

Given an array A1,A2…AN, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p≥0), select at most K indices in the array A, and for each selected index i, replace Ai with Ai⊕2p. Here, ⊕ denotes bitwise XOR.

3rd Jul 2021, 5:53 PM
Anikur Rahman
Anikur Rahman - avatar
2 Answers
0
Matiyas I dont ask anything without trying by my self,even nobody does.
4th Jul 2021, 4:54 PM
Anikur Rahman
Anikur Rahman - avatar
0
actually in the Q there is a mistake it should be 2^p not 2p
29th Jul 2021, 7:13 AM
sweety agrawal
sweety agrawal - avatar