Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

How many subarrays of [3, 1, 4, 1, 5] have their minimum equal to their first element?

  1. A. 10
  2. B. {C+5}
  3. C. 12
  4. D. 9

Correct answer: D. 9

A subarray qualifies when no element to its right is smaller than the first element. Ties count, so a later equal minimum does not disqualify it.

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

Exams that ask this topic