Data Structures & AlgorithmsModerateCAT · TCS NQT

Problem: How many three-digit numbers (100 to 999) have strictly increasing digits from left to right (for example 147 qualifies, 151 does not)?

  1. A. 120
  2. B. 165
  3. C. 84
  4. D. 504

Correct answer: C. 84

Any 3 distinct digits from 1-9 can be arranged in exactly one increasing order (0 cannot lead), so C(9, 3) = 84. Allowing 0 gives C(10, 3) = 120, allowing equal digits (non-decreasing) gives C(11, 3) = 165, and counting all numbers with distinct digits 1-9 gives 9·8·7 = 504.

More Coding Interview Problems questions

Exams that ask this topic