Data Structures & AlgorithmsVery hard

For each contiguous window of size 3 in 4 2 12 3 8 1 7, take its minimum. What is the largest of these window minimums?

  1. A. 1
  2. B. 12
  3. C. 7
  4. D. 3

Correct answer: D. 3

A deque keeps window minima in increasing order so the answer is found in one pass. Taking the smallest window minimum, the largest maximum, or an average gives different numbers.

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

Exams that ask this topic