Data Structures & AlgorithmsHardGATE CS · DSA

A monotonic deque reports the maximum of every window of size 3 in [14, 5, −3, 14, 5, 14, −5, 16, 4]. What is the SUM of all reported window maxima?

  1. A. 116
  2. B. 100
  3. C. 102
  4. D. 91

Correct answer: C. 102

Window maxima: [14, 14, 14, 14, 14, 16, 16], summing to 102. Taking the 7 largest elements overall double-counts big values that dominate several windows only once.

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

Exams that ask this topic