Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA

Sum the popcount of a[i] AND a[j] over all index pairs i < j of [7, 11, 13]. What is the total?

  1. A. 7
  2. B. 5
  3. C. 6
  4. D. 9

Correct answer: C. 6

Compute the three AND values: 7 AND 11 = 3, 7 AND 13 = 5, 11 AND 13 = 9, with popcounts 2, 2, 2. The total is 6.

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

Exams that ask this topic