Data Structures & AlgorithmsHardCAT · TCS NQT

Problem: The sum of all three-digit palindromic numbers (100–999) is what value?

  1. A. 45450
  2. B. 494550
  3. C. 49500
  4. D. 90

Correct answer: C. 49500

Palindromes aba = 101a + 10b sum to 101 · 45 · 10 + 10 · 45 · 9 = 45450 + 4050 = 49500. Dropping the middle-digit part gives 45450, 494550 sums all three-digit numbers, and 90 is the count.

More Coding Interview Problems questions

Exams that ask this topic