Data Structures & AlgorithmsHard

How many contiguous windows of length exactly 2 in 2 3 1 4 2 5 0 3 have a PRODUCT strictly greater than their SUM?

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

Correct answer: B. 3

For two numbers, product exceeds sum exactly when both are at least two and not both equal to two, which the direct test confirms. Using ≥, reversing the comparison, or skipping one position each change the count.

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

Exams that ask this topic