Data Structures & AlgorithmsHard

How many index pairs i < j in 1 2 3 4 6 8 satisfy A[i]·A[j] ≥ 2·(A[i] + A[j])?

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

Correct answer: B. 5

Rewrite as (x−2)(y−2) ≥ 4, which shows that pairs with a small value (1 or 2) never qualify. Strict inequality, a weaker bound, or the exact equality each change the count.

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

Exams that ask this topic