Data Structures & AlgorithmsVery hardCodeforces Div2 B · ICPC regional

How many non-empty contiguous subarrays of [10, 5, 2, 6] have a product strictly less than 100?

  1. A. 9
  2. B. 6
  3. C. 12
  4. D. 8

Correct answer: D. 8

Products grow as the right end extends, so two pointers (or brute force on this small array) works. Including products equal to 100 is a common off-by-one.

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

Exams that ask this topic