Data Structures & AlgorithmsHard

How many ORDERED pairs (i, j) with i ≠ j in 1 4 6 9 10 3 5 satisfy that A[i] + A[j] is divisible by 5?

  1. A. 10
  2. B. 5
  3. C. 12
  4. D. 6

Correct answer: A. 10

Ordered pairs count (i, j) and (j, i) separately, so the unordered count is doubled. Including i = j adds the diagonal, which the statement excludes.

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

Exams that ask this topic