Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional

How many distinct XOR values arise from index pairs i < j of [1, 2, 3, 4]?

  1. A. 6
  2. B. 7
  3. C. 12
  4. D. 1

Correct answer: A. 6

The six pair XORs are 3, 2, 5, 1, 6, 7, all distinct, so 6; it equals the pair count here, so the distinct check must still be explicit. 7 is the largest XOR value, 12 counts ordered pairs and 1 is the smallest XOR.

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

Exams that ask this topic