Data Structures & AlgorithmsHard

How many contiguous windows of length exactly 3 in 4 1 5 1 6 2 2 9 contain their minimum value AT LEAST TWICE?

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

Correct answer: B. 3

Count how often the window's minimum appears inside the window; at least two copies is the condition. Exactly one copy, repeated maxima, or any repetition each answer a different question.

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

Exams that ask this topic