Data Structures & AlgorithmsModerateTCS NQT Digital · CAT

Problem: Compute the sum of all integers from 1 to 999 whose digits are all odd.

  1. A. 250000
  2. B. 155
  3. C. 69375
  4. D. 70775

Correct answer: D. 70775

Numbers with only odd digits (5 + 25 + 125 = 155 of them) sum to 70775. Checking only the last digit sums all odd numbers to 250000, 155 is the count, and 69375 covers only the 3-digit ones.

More Coding Interview Problems questions

Exams that ask this topic