Data Structures & AlgorithmsModerateTCS NQT · SSC CGL Tier 2

Problem: What is the least common multiple of 6, 8 and 12?

  1. A. 576
  2. B. 24
  3. C. 48
  4. D. 2

Correct answer: B. 24

Highest prime powers: 2³ from 8 and 3 from 6 or 12, so lcm = 24. The product 6 · 8 · 12 = 576 overcounts, 6 · 8 = 48 multiplies just two of them, and 2 is the gcd.

More Coding Interview Problems questions

Exams that ask this topic