Data Structures & AlgorithmsHardCodeforces Div2 C · TCS NQT

What is the largest XOR value obtainable as the XOR of a non-empty contiguous subarray of [8, 1, 2, 12, 7, 6]?

  1. A. 36
  2. B. 14
  3. C. 15
  4. D. 37

Correct answer: C. 15

Brute force over all O(n²) subarrays keeps running XORs; the sum-based Kadane answer is a different quantity, because XOR does not add. Taking XOR of the whole array is only one candidate.

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

Exams that ask this topic