Data Structures & AlgorithmsModerate

How many NON-EMPTY subsets of 1 2 3 4 5 6 7 have bitwise XOR equal to 0?

  1. A. 16
  2. B. 63
  3. C. 15
  4. D. 14

Correct answer: C. 15

XOR-zero subsets form a linear-algebra family; here the non-empty ones are counted directly by enumerating all 127 subsets. The empty subset also has XOR 0, so it must be removed from the count.

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

Exams that ask this topic