Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

How many division steps (modulo operations) does Euclid's algorithm perform on the pair (252, 105) before the remainder becomes 0?

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

Correct answer: C. 3

The remainders are 252 mod 105 = 42, 105 mod 42 = 21, 42 mod 21 = 0, so there are three modulo steps.

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

Exams that ask this topic