Data Structures & AlgorithmsModerateTCS NQT Digital · Accenture

Problem: The string "mississippi" has its letters counted. What is the number of distinct letters that appear an odd number of times?

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

Correct answer: B. 1

Count each letter's occurrences and test the parity. 'm' appears once, 's' four times, 'i' four times and 'p' twice, so only 'm' is odd.

More Coding Interview Problems questions

Exams that ask this topic