Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA

How many integers from 1 to 60 inclusive are multiples of 3 or of 4 but not of 12?

  1. A. 26
  2. B. 30
  3. C. 25
  4. D. 5

Correct answer: C. 25

The union of multiples of 3 or 4 has 20 + 15 - 5 = 30 elements; removing the 5 multiples of 12 leaves 25.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic