Data Structures & AlgorithmsHardCodeforces Div 2 C · ICPC regional

From the values [3, 5, 6, 7, 10], choose any non-empty subset and XOR its elements together. What is the largest value that can be obtained?

  1. A. 15
  2. B. 13
  3. C. 16
  4. D. 10

Correct answer: A. 15

The maximum XOR over subsets is found with a linear basis (Gaussian elimination over GF(2)) or by enumerating all 31 non-empty subsets. Taking the largest value alone or the sum modulo 16 answers a different question.

More Coding Interview Problems questions

Exams that ask this topic