Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional

What is the sum of gcd over all contiguous subarrays of [4, 6, 8, 9]?

  1. A. 36
  2. B. 35
  3. C. 39
  4. D. 59

Correct answer: A. 36

Singletons give 27, the adjacent pairs give 5, the triples give 3 and the full array gives 1, for a total of 36.

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

Exams that ask this topic