Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA

How many entries of [7, 8, 11, 16, 15, 3] have the largest number of 1-bits in the array?

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

Correct answer: C. 1

Compute the 1-bit count of each element, take the maximum and count how many elements reach it. Counting the value rather than the number of matching elements is the trap.

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

Exams that ask this topic