Data Structures & AlgorithmsVery hard

How many contiguous windows of length 3 in 1 3 2 4 6 5 7 9 are strictly increasing?

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

Correct answer: D. 2

Each length-3 window is strictly increasing only if both consecutive pairs are strict, so check both comparisons. Allowing equal values, counting adjacent pairs, or testing only the outer values gives other totals.

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

Exams that ask this topic