Data Structures & AlgorithmsHard

How many subsets of exactly three elements of 1 2 3 4 5 6 (chosen by position) have XOR equal to 0?

  1. A. 2
  2. B. 4
  3. C. 0
  4. D. 10

Correct answer: B. 4

Enumerate all triples and test the XOR; a zero XOR of three values means the third equals the XOR of the first two. Counting residues of one, testing pairs, or testing the sum parity each measure a different property.

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

Exams that ask this topic