Data Structures & AlgorithmsModerateCodeforces Div2 B-D · ICPC regional

How many non-empty subsets of [1, 2, 3, 4, 5] have XOR of their elements equal to 0?

  1. A. 3
  2. B. 4
  3. C. 2
  4. D. 8

Correct answer: A. 3

Use a linear-basis insight: subsets with XOR zero are the dependencies among the values. Enumerating all 31 non-empty subsets by bitmask settles the count directly.

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

Exams that ask this topic