Data Structures & AlgorithmsHardCodeforces Div2 D · ICPC regional

For the list [3, 5, 6, 9, 10], how many subsets (including the empty subset) have a bitwise XOR of exactly 0?

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

Correct answer: D. 4

Bitmask-style DP over the list keeps, for each XOR value, the number of subsets that produce it. Forgetting that the empty subset has XOR 0 gives one fewer, and counting all 2ⁿ subsets ignores the XOR condition.

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

Exams that ask this topic