Data Structures & AlgorithmsHardGATE CS · TCS NQT

How many distinct values appear among the XORs of all non-empty contiguous subarrays of [1, 2, 3]?

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

Correct answer: C. 4

The subarray XORs are 1, 2, 3, 3, 1, 0; the distinct values are 0, 1, 2 and 3.

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

Exams that ask this topic