Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

How many index pairs i < j in [1, 4, 6, 3, 2] satisfy a[i] XOR a[j] < min(a[i], a[j])?

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

Correct answer: B. 2

Check each pair directly, comparing the XOR of the two values against the smaller of them.

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

Exams that ask this topic