Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: How many 4-digit numbers (1000–9999) are palindromes (read the same forwards and backwards in decimal)?

  1. A. 100
  2. B. 900
  3. C. 81
  4. D. 90

Correct answer: D. 90

Choose the first digit (1..9) and the second (0..9); the last two mirror them, so 9 × 10 = 90. Allowing a leading 0 gives 100, 900 counts 5-digit palindromes, and 81 wrongly bans 0 in the second digit.

More Coding Interview Problems questions

Exams that ask this topic