Data Structures & AlgorithmsHardTCS NQT · Accenture

How many values in [4, 4, 5, 6, 6, 7, 8] occur exactly once in the array?

  1. A. 4
  2. B. {C-1}
  3. C. 5
  4. D. 3

Correct answer: D. 3

The values that occur exactly once are 5, 7 and 8, so the answer is 3. Counting the repeated values 4 and 6 as well would be the mistake.

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

Exams that ask this topic