Data Structures & AlgorithmsHardCodeforces Div2 D · ICPC regional

How many subsets (chosen by position, the empty subset included) of [6, 1, 3, 5, 2] have a bitwise XOR equal to 4?

  1. A. 4
  2. B. 3
  3. C. 32
  4. D. 5

Correct answer: A. 4

Enumerate or DP over prefix XOR values: for each element, the set of achievable XORs doubles with the new element either included or not. The count is over subsets, so the empty subset counts when k = 0 and not otherwise.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic