Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: How many ordered pairs (a, b) of positive integers satisfy a × b = 36 with a ≤ 100 and b ≤ 100?

  1. A. 5
  2. B. 7
  3. C. 8
  4. D. 9

Correct answer: D. 9

Each divisor a of 36 = 2² · 3² fixes b = 36 / a, and both stay ≤ 100, so the count is d(36) = 3 × 3 = 9. Counting unordered pairs gives 5, excluding 1 and 36 gives 7, and leaving out (6, 6) gives 8.

More Coding Interview Problems questions

Exams that ask this topic