Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

How many windows of size 3 in [2, 9, 3, 4, 1, 1, 6] have a maximum strictly greater than the sum of the other two elements?

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

Correct answer: D. 4

Window max exceeding the sum of the other two is a triangle-inequality-style test. Each window is checked directly, and the count is the answer.

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

Exams that ask this topic